|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-08-24 23:05 UTC] sniper@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 00:00:01 2025 UTC |
Description: ------------ While building up a tree structure, i got strange troubles with some broken references. I used an array as stack holding references to objects. Some references within the object were broken after using a reference returned by array_pop. PHP 4.3.2-r4 (Apache/1.3.28) Reproduce code: --------------- class Gnaa { var $something; var $name; function Gnaa( $name ) { $this->name = $name;} function setGnaa( &$something ) { $this->something = &$something; } function &getGnaa() { return $something; } } $a =& new Gnaa("a"); $stack[] = &$a; $b =& new Gnaa("b"); $stack[] = &$b; $child = &array_pop($stack); // should be &$b $child->setGnaa( &$a ); print_r($child); // output differs! print_r( $b ); // Expected result: ---------------- That $b has the reference to $a, because $child should be a reference to $b.