Re: [RFC] [Discussion] Clone with

From: Date: Wed, 26 Apr 2023 00:24:58 +0000
Subject: Re: [RFC] [Discussion] Clone with
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-120133@lists.php.net to get a copy of this message
On Tue, Apr 25, 2023, at 11:23 AM, Nicolas Grekas wrote: > What about using a real closure to define the scope we need for cloning? > That closure would take the cloned instance as argument to allow > manipulating it at will. I believe someone mentioned that one previously in the thread. The problem is that the closure would run in the scope of the object, not the scope of the caller. That means if called outside the object, it would allow modifying private or protected properties. The itemized list of values (whether an array or named-args style) would allow the engine to enforce access restrictions, which is a desireable feature. --Larry Garfield

« previous php.internals (#120133) next »