Re: clone wars

From: Date: Mon, 16 Feb 2004 04:57:11 +0000
Subject: Re: clone wars
References: 1 2 3 4 5 6 7 8  Groups: php.internals 
Request: Send a blank email to internals+get-7861@lists.php.net to get a copy of this message
This too: class A {
    var $a = array();
    public function &getA()
    {
        return $this->a;
    }
} $A = new A; $A->a = array(1); $array = &$A->getA(); $clone = clone $A; $clone->a = array(); print_r($A); On 15 Feb 2004, at 9:14 PM, Herr Witten wrote:
Here, I have reproduced the problem: class A {
    var $a = array();
    public function makeAReference()
    {
        $array = $this->getA();
    }
    public function &getA()
    {
        return $this->a;
    }
} $A = new A; $A->a = array(1); $A->makeAReference(); $clone = clone $A; $clone->a = array(); print_r($A); Try it with an without $A->makeAReference() I sent in a report. Thanks.


« previous php.internals (#7861) next »