PHP 4.0 Bug #9479: new operator behaves in a really strange way

From: Date: Tue, 27 Feb 2001 14:16:56 +0000
Subject: PHP 4.0 Bug #9479: new operator behaves in a really strange way
Groups: php.dev 
Request: Send a blank email to php-dev+get-47620@lists.php.net to get a copy of this message
From: passionplay@hotmail.com Operating system: Linux Mandrake PHP version: 4.0.4pl1 PHP Bug Type: Scripting Engine problem Bug description: new operator behaves in a really strange way $objectlist=array(); class MyClass { function MyClass() { global $objectlist; // Save the reference for later use $objectList[]=&$this; } }; // the object referred to by $myobject is NOT in the array $myobject = new MyClass(); // $myobject2 exists in the array $myobject2 =& new MyClass(); It appears that there is an object being copied when returning from the constructor. What am I doing wrong? I'm not supposed to return anything from the constuctor. -- Edit Bug report at: http://bugs.php.net/?id=9479&edit=1

« previous php.dev (#47620) next »