#40721 [Opn->WFx]: Overload Comparison Problem
| From: | tony2001@php.net | Date: | Mon, 05 Mar 2007 10:09:46 +0000 |
| Subject: | #40721 [Opn->WFx]: Overload Comparison Problem | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-109901@lists.php.net to get a copy of this message | ||
ID: 40721
Updated by: tony2001@php.net
Reported By: rod at pu-gh dot com
-Status: Open
+Status: Wont fix
Bug Type: Scripting Engine problem
Operating System: Linux
PHP Version: 4.4.6
New Comment:
You'll have to upgrade to PHP5.
Previous Comments:
------------------------------------------------------------------------
[2007-03-05 03:00:52] 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
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=40721&edit=1