Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.6.0a3

Bug #3649 clone() fails
Submitted: 2005-02-28 20:05 UTC
From: ojai at nerim dot net Assigned: aidan
Status: Closed Package: PHP_Compat
PHP Version: 4.3.10 OS: Linux Debian
Roadmaps: (Not assigned)    
Subscription  


 [2005-02-28 20:05 UTC] ojai at nerim dot net
Description: ------------ Hi, When an object property is assigned an object reference with "=& new", clone() fails to do its job properly. Enjoy ;) Reproduce code: --------------- require_once 'PHP/Compat/Function/clone.php'; class B { var $c; } class A { var $b; function __clone() { $this->b = clone($this->b); } } $obj = new A(); $obj->b =& new B(); // It would work with = $obj->b->c = 1; $clone = clone ($obj); $clone->b->c = 2; echo '$obj->b->c == ' . $obj->b->c . "\n"; Expected result: ---------------- $obj->b->c == 1 Actual result: -------------- With PHP 5.0.2 : $obj->b->c == 1 With PHP 4.3.10 : $obj->b->c == 2

Comments

 [2005-05-01 10:38 UTC] aidan
Hi, So sorry for the ridiculous response time. I had been stumped on this for a while. I've fixed it with the serialize hack. It will be in the next version.