#44658 [Opn->Bgs]: References to references triggers unwanted further references
ID: 44658
Updated by: jani@php.net
Reported By: mo at nevali dot net
-Status: Open
+Status: Bogus
Bug Type: Arrays related
Operating System: FreeBSD 6
PHP Version: 5.2.5
New Comment:
This is the expected and correct output:
Created foo, foo->thing['stuff'] = 1234
Creating Bar, foo->thing['stuff'] = 1234
Created bar, bar->thing2['stuff'] = ABC
Created bar, foo->thing['stuff'] = ABC
Hint: References are not pointers.
Previous Comments:
------------------------------------------------------------------------
[2008-04-07 11:46:21] mo at nevali dot net
Description:
------------
Some circumstances involving deep references into arrays can cause
assignment of those arrays to always assign references instead of
values.
Reproduce code:
---------------
Please see http://nevali.net/docs/array-refs-testcase.phps
Expected result:
----------------
The code should produce the following output:
Created foo, foo->thing['stuff'] = 1234
Creating Bar, foo->thing['stuff'] = 1234
Created bar, bar->thing2['stuff'] = ABC
Created bar, foo->thing['stuff'] = 1234
Actual result:
--------------
Created foo, foo->thing['stuff'] = 1234
Creating Bar, foo->thing['stuff'] = 1234
Created bar, bar->thing2['stuff'] = ABC
Created bar, foo->thing['stuff'] = ABC
If the (marked) line in Foo's constructor:
$this->stuff =& $this->thing['stuff'];
is removed, the output is as expected, even though this code should be
inert (Foo::stuff is not referenced from anywhere else in the test
code).
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=44658&edit=1
Thread (9 messages)