From: php at cyruslesser dot com
Operating system: Linux Debian
PHP version: 5.0.0
PHP Bug Type: Class/Object related
Bug description: After copying a class, changes to new class affect old class.
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 bug report at http://bugs.php.net/?id=29441&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=29441&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=29441&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=29441&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=29441&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=29441&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=29441&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=29441&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=29441&r=support
Expected behavior: http://bugs.php.net/fix.php?id=29441&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=29441&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=29441&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=29441&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29441&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=29441&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=29441&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=29441&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=29441&r=float