Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:121447 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 37439 invoked from network); 23 Oct 2023 15:39:37 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 23 Oct 2023 15:39:37 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 822041804A7 for ; Mon, 23 Oct 2023 08:39:37 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00,KHOP_HELO_FCRDNS, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS16276 192.99.0.0/16 X-Spam-Virus: No X-Envelope-From: Received: from mail.processus.org (ns563681.ip-192-99-44.net [192.99.44.131]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 23 Oct 2023 08:39:37 -0700 (PDT) Message-ID: <8835c45d-fb4d-4701-ae5c-aa0d956cdb8b@processus.org> Authentication-Results: mail.processus.org; auth=pass smtp.mailfrom=pierre-php@processus.org Date: Mon, 23 Oct 2023 17:39:34 +0200 MIME-Version: 1.0 Content-Language: en-US To: Saki Takamachi Cc: PHP internals References: <5be74be4-972f-4eae-ae46-6d92587ccc7f@processus.org> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spamd-Bar: / Subject: Re: [PHP-DEV] Constructor promoted property and default value From: pierre-php@processus.org (Pierre) 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