Bug #68262 [Opn->Csd]: Broken reference across clonned objects

From: Date: Sun, 19 Oct 2014 11:23:02 +0000
Subject: Bug #68262 [Opn->Csd]: Broken reference across clonned objects
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-188189@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=68262&edit=1 ID: 68262 Updated by: nikic@php.net Reported by: miloslav dot hula at gmail dot com Summary: Broken reference across clonned objects -Status: Open +Status: Closed Type: Bug Package: Scripting Engine problem Operating System: Linux PHP Version: master-Git-2014-10-18 (Git) Block user comment: N Private report: N New Comment: Automatic comment on behalf of nikic Revision: http://git.php.net/?p=php-src.git;a=commit;h=4b892439e61634b4bdcbf0bd54ef8577575875fd Log: Fix bug #68262: Broken reference across cloned objects Previous Comments: ------------------------------------------------------------------------ [2014-10-18 23:17:39] miloslav dot hula at gmail dot com Description: ------------ Tested on fb85d0322d39d49f37e32df6f68c9769f2cce0e4 (17.10.2014) Code works on PHP 5.0.0 - 5.6.2 (via http://3v4l.org). Hard to describe. Test script below is extracted from failing library test. Clonned object affects original one by reference in magic __get() method. Test script: --------------- class C { public $p; public function &__get($n) { return $this->p; } } $first = new C; $first->p = 'init'; $clone = clone $first; $clone->p = $first->magic; $clone = clone $first; $clone->p = 'foo'; var_dump($first->v); Expected result: ---------------- string(4) "init" Actual result: -------------- string(3) "foo" ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=68262&edit=1

« previous php.bugs (#188189) next »