ID: 46277 Updated by: [email protected] Reported By: ido at niger dot co dot il -Status: Open +Status: Bogus Bug Type: Scripting Engine problem Operating System: * PHP Version: 5CVS, 6CVS (2008-10-22) 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 http://www.php.net/manual/en/language.references.whatdo.php Previous Comments: ------------------------------------------------------------------------ [2008-10-12 10:26:04] ido at niger dot co dot il Description: ------------ The example prints 9 as the value of $a , though it should be 8; The fact the referencing $a[0] causes $a[0] to become a reference itself , is dangerous in cases like this where it is possible to change the value of $a[0] though it was not originally defined as a reference. Reproduce code: --------------- function a($c){ $c[0] = 9; } $a[0] = 8; $c = &$a[0]; a($a); echo $a[0]; Expected result: ---------------- The value of $a should be 8 Actual result: -------------- The value printed is 9 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=46277&edit=1
