Bug #1332: Referencing the same object from two variables

From: Date: Tue, 20 Apr 1999 11:49:41 +0000
Subject: Bug #1332: Referencing the same object from two variables
Groups: php.dev 
Request: Send a blank email to php-dev+get-5150@lists.php.net to get a copy of this message
From: ursem@albatros.dk Operating system: WinNT PHP version: 3.0.5 PHP Bug Type: Other Bug description: Referencing the same object from two variables I have experienced "working on a copy"-problem with one object and two variables containing the object. Example: (Untested) <? class someobject { var $a=4; } $myobj = new someobject; $ref1 = $myobj; $ref2 = $myobj; $ref2->a = 5; ?> Now ref1 is a someobject where a=4 and ref2 is a someobject where a = 5. I would expect that ref1 and ref2 points to the same object and thus the assignment ref1->a=5 will cause the object referenced by ref1 and ref2 to be updated since it is the same object. <br><br> This is very annoying and the whole point of having objects and classes seems to disappear, except for their "functionality-wrapping" features. -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#5150) next »