From: ladislav dot prosek at matfyz dot cz Operating system: Windows XP SP2 PHP version: 5.0.4 PHP Bug Type: Zend Engine 2 problem Bug description: Assignment by reference causes crash when field access is overloaded (__get)
Description: ------------ There is probably a bug in memory allocation related to property getters. Note that the behavior depends on lengths of the two strings and also on the way the $q property is initialized. Reproduce code: --------------- class A { var $q; function __construct() { $this->q = array(); } function __get($name) { return $this->q; } }; $a = new A; $b = "short"; $a->whatever =& $b; $b = "much longer"; var_dump($a); Expected result: ---------------- // as __get does not return a reference // the output should IMHO look like this: object(A)#1 (1) { ["q"]=> array(0) { } } // if you guys think the output should be // different, please do explain it! Actual result: -------------- object(A)#1 (1) { ["q"]=> CRASH! -- Edit bug report at http://bugs.php.net/?id=32660&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32660&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=32660&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=32660&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=32660&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=32660&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=32660&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=32660&r=needscript Try newer version: http://bugs.php.net/fix.php?id=32660&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=32660&r=support Expected behavior: http://bugs.php.net/fix.php?id=32660&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=32660&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=32660&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=32660&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32660&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=32660&r=dst IIS Stability: http://bugs.php.net/fix.php?id=32660&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=32660&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=32660&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=32660&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=32660&r=mysqlcfg