On Mon, Aug 30, 2021 at 2:14 PM Côme Chilliet < come.chill...@fusiondirectory.org> wrote:
> Le Wed, 25 Aug 2021 12:02:49 +0200, > Nikita Popov <nikita....@gmail.com> a écrit : > > Hi internals, > > > > I'd like to propose the deprecation of "dynamic properties", that is > > properties that have not been declared in the class (stdClass and > > __get/__set excluded, of course): > > > > https://wiki.php.net/rfc/deprecate_dynamic_properties > > If I understand correctly the RFC, in these two classes: > > class A { > public $prop; > > public function __construct() { > unset($this->prop); > } > } > > class B { > public $prop; > } > > The property $prop is not in the same state in the end? What is the > difference? > isset returns FALSE for both, no? And property_exists? > In the latter case, the property has value null. In the former case, it is unset. In both cases, it is declared. Accessing an unset property will trigger __get/__set. Accessing a null property will not (assuming it is visible). Is it something that was the same before the RFC and would be different > after, > or is it already two different cases and how? This RFC does not have any impact on this behavior. This is a "standard" pattern used for lazy initialization. Regards, Nikita