Bug #71009 [NEW]: A reference references multiple variables after clone.

From: Date: Tue, 01 Dec 2015 14:24:31 +0000
Subject: Bug #71009 [NEW]: A reference references multiple variables after clone.
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-197544@lists.php.net to get a copy of this message
From: remyfox at hotmail dot com Operating system: Windows PHP version: 5.6.16 Package: Class/Object related Bug Type: Bug Bug description:A reference references multiple variables after clone. Description: ------------ The values that are printed are both 11 and 12. I doubt this is correct behaviour. Test script: --------------- class A { public $z = 10; } $a1 = new A(); $z = &$a1->z; $a2 = clone $a1; $a1->z = 11; var_dump($z); $a2->z = 12; var_dump($z); -- Edit bug report at https://bugs.php.net/bug.php?id=71009&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71009&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71009&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71009&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=71009&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=71009&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=71009&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=71009&r=needscript Try newer version: https://bugs.php.net/fix.php?id=71009&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=71009&r=support Expected behavior: https://bugs.php.net/fix.php?id=71009&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=71009&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=71009&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=71009&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71009&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=71009&r=dst IIS Stability: https://bugs.php.net/fix.php?id=71009&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=71009&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=71009&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=71009&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=71009&r=mysqlcfg

« previous php.bugs (#197544) next »