#47587 [Opn->Bgs]: When exactly is __clone() executed?

From: Date: Fri, 06 Mar 2009 13:34:40 +0000
Subject: #47587 [Opn->Bgs]: When exactly is __clone() executed?
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-1943@lists.php.net to get a copy of this message
ID: 47587 Updated by: rquadling@php.net Reported By: scout at hyperspace-travel dot de -Status: Open +Status: Bogus Bug Type: Documentation problem PHP Version: Irrelevant New Comment: http://docs.php.net/manual/en/language.oop5.cloning.php gives a clear explanation of what happens when cloning is applied to an object. "When an object is cloned, PHP 5 will perform a shallow copy of all of the object's properties. Any properties that are references to other variables, will remain references. If a __clone() method is defined, then the newly created object's __clone() method will be called, to allow any necessary properties that need to be changed." Previous Comments: ------------------------------------------------------------------------ [2009-03-06 13:25:36] scout at hyperspace-travel dot de Description: ------------ The documentation does not mention when exactly the __clone() method is performed. Neither does any of the comments. No I figure it is done AFTER shallow-copying the attributes of the old object to the new on, as everything else would be braindead. But still, it would be nice to have this information written down because that is a pretty crucial detail and it helps to understand the process of cloning in the first place. Greets, Lene Reproduce code: --------------- --- From manual page: language.oop5.cloning --- ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=47587&edit=1

« previous php.doc.bugs (#1943) next »