ID: 40050 Updated by: [EMAIL PROTECTED] Reported By: BenBE at omorphia dot de -Status: Open +Status: Bogus Bug Type: Scripting Engine problem Operating System: Windows 2K PHP Version: 5.2.0 New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php . Previous Comments: ------------------------------------------------------------------------ [2007-01-07 19:57:47] BenBE at omorphia dot de Description: ------------ When assigning an array by-value into itself PHP will insert a self-referencing Array into the new entry Reproduce code: --------------- $a = array(); $a[] =& $a; print_r($a); $b = array(); $b[] = $b; print_r($b); Expected result: ---------------- array(1) { [0]=> array(1) { [0]=> array(1) { [0]=> *RECURSION* } } } array(1) { [0]=> array(0) { } } $b[0] should contain an empty array because $b was assigned by-value, i.e. should get copied. Actual result: -------------- array(1) { [0]=> array(1) { [0]=> array(1) { [0]=> *RECURSION* } } } array(1) { [0]=> array(1) { [0]=> array(1) { [0]=> *RECURSION* } } } Comparing the references (see my entry regarding Spotting References) you find that $b and $b[0] are different pointers and $b[0] is an array like the one created in $a. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=40050&edit=1