ID: 29441 User updated by: php at cyruslesser dot com Reported By: php at cyruslesser dot com Status: Bogus Bug Type: Class/Object related Operating System: Linux Debian PHP Version: 5.0.0 New Comment:
Well, in version 4.3.8, it returns a: 1 b: 2 In version 5.0.0 it returns (without error or notification) a: 2 b: 2 That may or may not be intentional, but if there's a way to copy an object instead of a pointer to an object, I can't find it in the manual. Cyrus Lesser Previous Comments: ------------------------------------------------------------------------ [2004-08-02 12:56:01] [EMAIL PROTECTED] Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php . ------------------------------------------------------------------------ [2004-07-29 08:44:27] php at cyruslesser dot com Description: ------------ This may just be my mis-understanding of how the language should work, but surely when you copy an object (class) and make changes to it, those changes shouldn't affect the original object? I don't really see the point in making a copy of an object, if the changes you make to the new copy affect the old copy. If I'm just dumb, then I apologise. Reproduce code: --------------- <? class c { var $i = 0; }; $a = new c; $a->i = 1; $b = $a; $b->i = 2; echo "a: $a->i"; echo "b: $b->i"; ?> Expected result: ---------------- a: 1 b: 2 Actual result: -------------- a: 2 b: 2 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=29441&edit=1