php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40721 Overload Comparison Problem
Submitted: 2007-03-05 03:00 UTC Modified: 2007-03-05 10:09 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: rod at pu-gh dot com Assigned:
Status: Wont fix Package: Scripting Engine problem
PHP Version: 4.4.6 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: rod at pu-gh dot com
New email:
PHP Version: OS:

 

 [2007-03-05 03:00 UTC] rod at pu-gh dot com
Description:
------------
When overloading a class in php, and then comparing an overloaded property to the return value of a function call, the result is not what I expected.  If comparing against string literals, or if the result of each is first assigned to a variable then it's fine.

I tested this with latest CVS of PHP 4.4.7.

Reproduce code:
---------------
<?

class Foo {
	function __get( $name, &$value ) {
		$value = 'foo';
		return true;
	}
}
overload( 'Foo' );

class Bar {
	function foo() {
		return 'bar';
	}
}

$foo = new Foo();
$bar = new Bar();

echo 'Test: ' . ( $foo->bar == $bar->foo() ? 'BAD' : 'GOOD' ) . "\n";

?>

Expected result:
----------------
Expected (meaning the comparsion failed):

Test: GOOD

Actual result:
--------------
Actual (meaning the comparsion 'foo' == 'bar' succeeded):

Test: BAD

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-03-05 10:09 UTC] tony2001@php.net
You'll have to upgrade to PHP5.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 02 19:01:36 2025 UTC