Re: [VOTE] Clone with v2
| From: | Tim Düsterhus | Date: | Thu, 12 Jun 2025 08:53:56 +0000 |
| Subject: | Re: [VOTE] Clone with v2 | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-127654@lists.php.net to get a copy of this message | ||
Hi
Am 2025-06-11 22:09, schrieb Andreas Hennings:
This is only true to a very small extent, specifically for `public public(set) readonly` properties. For non-readonly properties, the user could just write into the properties after cloning, forCalling __clone() afterward would mean the new properties would already be set and the old ones gone, contrasting existing behavior and thus users' expectations.But in fact both of the following sentences are true: - Currently, no further changes are applied to a cloned object after __clone() is called.
protected(set) readonly, the user can just overwrite __clone() and for private(set) readonly the class is in control.
Rowan already summarized that during the discussion in https://externals.io/message/127353#127389 and Volker confirmed that we agreed with that.
- Currently, no changes are applied to a cloned object before __clone() is called. Both of these statements can describe user expectations, but each of them justifies a different version of the RFC.Best regards Tim Düsterhus