ID: 32660 Updated by: [EMAIL PROTECTED] Reported By: ladislav dot prosek at matfyz dot cz Status: Verified Bug Type: Zend Engine 2 problem Operating System: * PHP Version: 5CVS-2005-04-11 New Comment:
Initializing $a->whatever before assigning reference can be used as a temporary workaround. Previous Comments: ------------------------------------------------------------------------ [2005-04-11 02:04:49] [EMAIL PROTECTED] object(A)#1 (1) { ["q"]=> &UNKNOWN:0 } /usr/src/php/php5/Zend/zend_execute.c(891) : Freeing 0x0A117D6C (16 bytes), script=/home/jani/t.php /usr/src/php/php5/Zend/zend_variables.h(45) : Freeing 0x0A117D2C (12 bytes), script=/home/jani/t.php /usr/src/php/php5/Zend/zend_variables.c(120) : Actual location (location was relayed) === Total 2 memory leaks detected === ------------------------------------------------------------------------ [2005-04-10 22:22:04] ladislav dot prosek at matfyz dot cz 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 this bug report at http://bugs.php.net/?id=32660&edit=1