From: php at hartwerk dot com Operating system: Linux PHP version: 5.0.2 PHP Bug Type: Zend Engine 2 problem Bug description: Assignment operators yield wrong result with __get/__set
Description: ------------ When there is a function on the right-hand side of an assignment operator expression, and the variable is to be accessed via __get/__set, the operation yields wrong results. Reproduce code: --------------- class Container { public function __get( $what ) { return $this->_p[ $what ]; } public function __set( $what, $value ) { $this->_p[ $what ] = $value; } private $_p = array(); } $c = new Container(); $c->a = 1; $c->a += 1; print $c->a; // --> 2 print " - "; $c->a += max( 0, 1 ); print $c->a; // --> 4 (!) Expected result: ---------------- 2 - 3 Actual result: -------------- 2 - 4 -- Edit bug report at http://bugs.php.net/?id=30394&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30394&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30394&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30394&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=30394&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=30394&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=30394&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=30394&r=needscript Try newer version: http://bugs.php.net/fix.php?id=30394&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=30394&r=support Expected behavior: http://bugs.php.net/fix.php?id=30394&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=30394&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=30394&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=30394&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30394&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=30394&r=dst IIS Stability: http://bugs.php.net/fix.php?id=30394&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=30394&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=30394&r=float MySQL Configuration Error: http://bugs.php.net/fix.php?id=30394&r=mysqlcfg