ID: 35163 Updated by: [EMAIL PROTECTED] Reported By: averagomez at hotmail dot com -Status: Closed +Status: Assigned Bug Type: Arrays related Operating System: * PHP Version: 5CVS-2005-11-09 (cvs) Assigned To: dmitry New Comment:
The bug still exists in 5.2 it need just another test script. Previous Comments: ------------------------------------------------------------------------ [2006-08-01 23:03:00] [EMAIL PROTECTED] Not reproducible with 5.2-CVS. ------------------------------------------------------------------------ [2005-11-16 14:52:19] [EMAIL PROTECTED] 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. ------------------------------------------------------------------------ [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