ID: 35163 Updated by: [EMAIL PROTECTED] Reported By: averagomez at hotmail dot com Status: Assigned Bug Type: Arrays related Operating System: * PHP Version: 5CVS-2005-11-09 (cvs) Assigned To: dmitry New Comment:
5.1 is effected too. <?php $a = array(array('A')); //$b = &$a[0]; $a[0][] =& $a[0]; $a[0][] =& $a[0]; $a[0][0] = 'b'; var_dump($a); $a = null; $b = null; ?> The problem is in "$a[0][] =& $a[0];" operator, that creates copy of $a[0] during fetching lvalue because $a[0] is not a reference and after fetching rvalue it has refcount > 1. Previous Comments: ------------------------------------------------------------------------ [2005-11-09 15:32:49] [EMAIL PROTECTED] This is what I get: B/usr/src/php_5_1/Zend/zend_variables.h(45) : Freeing 0x09E76844 (2 bytes), script=/www/igglo/t.php /usr/src/php_5_1/Zend/zend_variables.c(120) : Actual location (location was relayed) /usr/src/php_5_1/Zend/zend_execute.c(1009) : Freeing 0x09E665D4 (35 bytes), script=/www/igglo/t.php /usr/src/php_5_1/Zend/zend_hash.c(383) : Actual location (location was relayed) Last leak repeated 1 time /usr/src/php_5_1/Zend/zend_vm_execute.h(3361) : Freeing 0x09E664CC (35 bytes), script=/www/igglo/t.php /usr/src/php_5_1/Zend/zend_hash.c(383) : Actual location (location was relayed) /usr/src/php_5_1/Zend/zend_vm_execute.h(3311) : Freeing 0x09E77754 (32 bytes), script=/www/igglo/t.php /usr/src/php_5_1/Zend/zend_hash.c(169) : Actual location (location was relayed) Last leak repeated 1 time /usr/src/php_5_1/Zend/zend_vm_execute.h(3330) : Freeing 0x09E7196C (16 bytes), script=/www/igglo/t.php /usr/src/php_5_1/Zend/zend_execute.c(842) : Freeing 0x09E7192C (16 bytes), script=/www/igglo/t.php === Total 8 memory leaks detected === Dmitry, can you check if you can fix the leaks? ------------------------------------------------------------------------ [2005-11-09 14:43:54] averagomez at hotmail dot com Work OK in PHP 5.1.0RC5-dev ------------------------------------------------------------------------ [2005-11-09 08:52:22] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php5-latest.tar.gz For Windows: http://snaps.php.net/win32/php5-win32-latest.zip ------------------------------------------------------------------------ [2005-11-09 05:45:44] averagomez at hotmail dot com Description: ------------ Sorry I have a very bad english but I think the 'Reproduce code' is self-describing. Reproduce code: --------------- // ---------- This work OK: $a = array('A', & $a, & $a); $a[1][0] = 'B'; echo $a[0]; // OK : Show 'B' // ---------- But this don't work: $a = array('A'); $a[1] = & $a; $a[2] = & $a; $a[1][0] = 'B'; echo $a[0]; // Wrong: Show 'A' Expected result: ---------------- BB Actual result: -------------- BA ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=35163&edit=1