|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2020-02-20 12:57 UTC] nikic@php.net
-Status: Open
+Status: Not a bug
[2020-02-20 12:57 UTC] nikic@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 08 04:00:01 2026 UTC |
Description: ------------ - The result of clone passed as an argument provokes a recursive reference. + The result of clone stored in the variable that is passed as an argument does not cause problems. Test script: --------------- function assign(&$r, $c){ $r = $c; } class A{ private $c; public function run(){ assign($this->c, clone $this); // this code generates actual result //$c = clone $this; //assign($this->c, $c); this code generates the expected result } } $o = new A(); $o->run(); var_dump($o); Expected result: ---------------- object(A)#27 (1) { ["c":"A":private]=> object(A)#13 (1) { ["c":"A":private]=> NULL } } Actual result: -------------- object(A)#21 (1) { ["c":"A":private]=> &object(A)#20 (1) { ["c":"A":private]=> *RECURSION* } }