Re: Constructor promoted property and default value

From: Date: Mon, 23 Oct 2023 15:35:36 +0000
Subject: Re: Constructor promoted property and default value
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-121446@lists.php.net to get a copy of this message
Hi, Pierre You may have overlooked the existence of the magic method __unserialize(). Constructor is not the only way to create instances. When rebuilding a serialized object, you may need the initial values ​​of properties. This can easily happen if you are using rolling updates and using Redis. The constructor is not called if __unserialize() is called. In this case, defining the initial value of a property as an argument to a constructor that is never called confuses us. Regards. Saki

« previous php.internals (#121446) next »