|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-03-05 10:09 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 21:00:01 2025 UTC |
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