From: ms419 at freezone dot co dot uk Operating system: Debian PHP version: 5.2.6 PHP Bug Type: Scripting Engine problem Bug description: __get() behaves unpredictably
Description: ------------ I have a class (in the reproduce code "Test") which is basically a container for some attributes. Some of the attributes are the results of expressions which I only want to evaluate when the attribute is accessed for the first time. The __get() function seems perfect for this. One attribute is "repository" - its value should be the result of an expression, concatenated with a slash character and another attribute ("name"), if "name" is not null. When "name" is not null, the first time "repository" is accessed, __get() returns the result of the expression, without anything concatenated. The second time "repository" is accessed, __get() returns just a slash character and "name", without the result of the expression. Reproduce code: --------------- http://cgi.sfu.ca/~jdbates/tmp/php/200811130/test.phps Expected result: ---------------- ket% php test.php string(9) "some expr/name" string(4) "some expr/name" ket% Actual result: -------------- ket% php test.php string(9) "some expr" string(4) "/name" ket% -- Edit bug report at http://bugs.php.net/?id=46570&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=46570&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=46570&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=46570&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=46570&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=46570&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=46570&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=46570&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=46570&r=needscript Try newer version: http://bugs.php.net/fix.php?id=46570&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=46570&r=support Expected behavior: http://bugs.php.net/fix.php?id=46570&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=46570&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=46570&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=46570&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46570&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=46570&r=dst IIS Stability: http://bugs.php.net/fix.php?id=46570&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=46570&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=46570&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=46570&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=46570&r=mysqlcfg