Re: Constructor promoted property and default value

From: Date: Mon, 23 Oct 2023 15:39:34 +0000
Subject: Re: Constructor promoted property and default value
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-121447@lists.php.net to get a copy of this message
Le 23/10/2023 à 17:35, Saki Takamachi a écrit :
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
If I understand your use case properly, you should be confused by properties with default values that are not constructor-promoted as well ? Am I wrong ? In this case, your problem is not with promoted properties ? Regards, -- Pierre

« previous php.internals (#121447) next »