|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits              [2002-06-01 09:55 UTC] mfischer@php.net
 | |||||||||||||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 10:00:02 2025 UTC | 
Calling an object's method turn the object into a reference to itself. When the object is itself an array's value (or an object's instance variable) this shows up when copying (with simple assignement) the surrounding array (or object). class bar{ var $my_var = 'bar'; function buggy(){/*nothing needed here*/} } $foo[0] = new bar(); $foo[0]->buggy(); // turns the array's value into a reference to the object $new = $foo; $new[0]->my_var = 'new'; echo $foo[0]->my_var;// echoes 'new' !! Comment out the call to buggy(), or use var_dump before and after this call to see the magic transformation of $foo[0] from object(bar) to &object(bar). Tested with 4.0.3 and 4.1. The same bug has been reported under #11543 (open but unanswered). The code above is much simpler than that in the original bug report. (I could not edit that one :)) best regards Ivan