ID: 9479
Updated by: stas
Reported By: [EMAIL PROTECTED]
Old-Status: Open
Status: Closed
Bug Type: Scripting Engine problem
Assigned To: 
Comments:

Yes, when you do a $obj = new Foo(), the object is copied.
Use =& if you want reference. 

Previous Comments:
---------------------------------------------------------------------------

[2001-02-27 09:16:56] [EMAIL PROTECTED]
$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.

---------------------------------------------------------------------------



ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at http://bugs.php.net/?id=9479&edit=2


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to