Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:121446 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 36066 invoked from network); 23 Oct 2023 15:35:53 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 23 Oct 2023 15:35:53 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id E102F1804BC for ; Mon, 23 Oct 2023 08:35:51 -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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS9370 160.16.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail.sakiot.com (mail.sakiot.com [160.16.227.216]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 23 Oct 2023 08:35:51 -0700 (PDT) Received: from smtpclient.apple (softbank060067217005.bbtec.net [60.67.217.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.sakiot.com (Postfix) with ESMTPSA id 58171401E7; Tue, 24 Oct 2023 00:35:48 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=sakiot.com; s=default; t=1698075348; bh=RCkyJZNbeTxzmkxmO1FMDagGbPSmpSX1IAH99swImFg=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=fKBgDd2Zrw3Pb/V3bnEhKyHc1Gf22klZfKALwqpuKdLBC23Adg+O3CtNzSjSpWRAO Yj1y+CZDAc8qBfwAUn1GvCWqtJ4DeKjR0+dL08AFZp0ZP1/JB3C1f4MdLogtNAwlJ2 wLKNFObotiRpCRXvkiEuMqaA9RJc9Eq1OenYFi1w= Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.700.6\)) In-Reply-To: <5be74be4-972f-4eae-ae46-6d92587ccc7f@processus.org> Date: Tue, 24 Oct 2023 00:35:36 +0900 Cc: PHP internals Content-Transfer-Encoding: quoted-printable Message-ID: References: <5be74be4-972f-4eae-ae46-6d92587ccc7f@processus.org> To: Pierre X-Mailer: Apple Mail (2.3731.700.6) Subject: Re: [PHP-DEV] Constructor promoted property and default value From: saki@sakiot.com (Saki Takamachi) 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 = =E2=80=8B=E2=80=8Bof 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=