Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:130158 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by lists.php.net (Postfix) with ESMTPS id E0C0B1A00BC for ; Tue, 24 Feb 2026 19:34:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1771961678; bh=tG3lSeHWTAeeNzEtvFt5XKNbtJFbcsDhdH/waMrOXEY=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Ob3lSj0Eu0PgbxFa0SgrhwrHJtw90aQGTub0X4faYH9PeVF5w1X8sYU5byq7QPUJb DY2gYk+2XlOJX57fv1wmL66zHvY3ZsEt8a6kjVq1ryINg05U/yggMzLWCayrLpycHQ LGEj5+hqDQGkwHtuMryaAvS/DXdMqg7+C1dCAhHVqXtMRIn8Q7DPmp8XqSbR7alXWI V+tMEZ0Zka/cwVZIob0OZuY9hsKk1HYenpJX8Mb4WMq2cedD5yhc39dicmc85UW3hu T1PrYczoKPXWwX/BYPhpQnEXa19bovZjVmx4vOY1yc03e3dLYez6sP47/5SJ11Gpml KJ3zWYZxadwHw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id A6CE51808F5 for ; Tue, 24 Feb 2026 19:34:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: * X-Spam-Status: No, score=1.6 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_50, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS, FORGED_GMAIL_RCVD,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from mail-qv1-f53.google.com (mail-qv1-f53.google.com [209.85.219.53]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 24 Feb 2026 19:34:34 +0000 (UTC) Received: by mail-qv1-f53.google.com with SMTP id 6a1803df08f44-899b08be919so5682006d6.0 for ; Tue, 24 Feb 2026 11:34:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1771961669; cv=none; d=google.com; s=arc-20240605; b=gk0x1W7fsSzt34k5lQqFv95f/sdVrNQnt8CY4GNGOE9W+7kx5ttQhbWlAb2Yqm5XJp 3RdIGdOKwj+LxhVkwdoOwoq+wM9qbNFd10mt6oLJoxKkvvbONFOyUWkRot1hlkHUtKAB bQ86THfB1vW9rWDI+BDAfhh9d819fVSO0AUZNcXGMXijjrrPC5WyuqiFVGCzxRnNsFl1 R88+9qExHtSGWqzE53d70ZTaz8qu4wvEHB/YSiKDVmm8zrbMed+iqzpCsRmMk2Ug+BVF 8urW3MAGso+bikjK6TyQ1NEZVx7Q4nhZ/M57dFsdDNKE47PNxT3gAjI/913gX7srOEsz KFXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=8vdICEtHIcWGGEaGtonq3wJOE71g2zB29EH1c6001gE=; fh=Ofn+XpSLefQyxrNYeqFK5V6BgIEzMTvoqvpJ6/SQfuk=; b=AotAFrleu7oHtkH29mLAsPBUt2J3Ft7M2c7YLh+zHoBeHzics1YCJ9tX22tRt624WI Rkf++fCM0sfeKJMhPrYhiBR2jdVMYxX7jD1px4nAKIvVGf+F4vs2vhCRli198gGk8zQd A1N8hzH6LAI5UzYOgVgM7Af13Vff5dAAezBEIwcncRy+e+TJVvwPK2yW9WrpwSMQmJJ/ 7+tJZnzIjqaVdDMCA+Dfy/4gKSKeuzYaZS9U25tpgCBq07QqXBAEIplv0eZL/D9YUO1C vpFu4I1/PEHky8GW/Je1UNChlTrkb3eTqKWNHsGpkZJxpsmJ5l5Vm31PhVJ2XxYPQ0aM YtGQ==; darn=lists.php.net ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1771961669; x=1772566469; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=8vdICEtHIcWGGEaGtonq3wJOE71g2zB29EH1c6001gE=; b=S0PNuQ+L7UO0fCY1cFzJkEIvjgA4hTPDjuDaajMZfX0sKn673sbKumygMIC+O1igWc lUcGWY0ocaq/2GHgcPc5dXQibTiAz7EDhoPzIfS2mNdqIFlMW5L0OqO63RMJN5p1uYTX +NgReSPNvuEAKKO0lVh5OLL/N1JwuQy4mUC+w0sxe5n/7IqxmU036N9aZPdKQu/D9Hz3 sLjFlGwsgJUII3tXkCYJCqxdgjvZWGMnHe8hw51OItfX3j+XAv22R8itk24hXScvnU2/ KpEiDsA2P+xO9P+KbarEOxMQQN82MO3ZhA005X0Evfq9R/MuwwIhQhJ1Nq4TIT7OV1JU SSpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771961669; x=1772566469; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=8vdICEtHIcWGGEaGtonq3wJOE71g2zB29EH1c6001gE=; b=HwAVKbcp2hjxqN4MM4jCONu23eJIsJPHkfoHSCQKARHMr7Vy50ysSA+dsAkUDto0fC V39aisaFtduzG92M3PfEPmPGgUd5OQXYdFbvyU4I8sVKzi9YCkHka7OK8CIjlgMS+NQn q1+0OOxa4i+ruRFZJqI64ph7Xumib1zQUe82H1VV89aEPYPKahuKYZoOt01vYly08LMj mMHPySVd+mGBS333EoHAuuF2rlydiSAOPFMJ+9wa3bPvPkAHnqHH9NoMm+uS4UM7l81S YRvh2GVC9Go02aeY1OWKyFYTs5WenrW4nJvbsvdfIr16vdf9fTMTj0fHHw1KGPc3umnL tMKQ== X-Gm-Message-State: AOJu0Yz3D7TR/j9FprxEOjjvzeo2ZVYFfHPG6xJlzwQBNetTbomsC96q CM/pjHUWSVR0XO/EpywS97ig8aWmWBWnG2O84K9h6K65ZS8333nE+OU8tEaCQR6efAOFGMEGP3L zFV0Gut+sbRXkXXHgwDauB4zP4cHEPsmYwPMlcBg= X-Gm-Gg: ATEYQzxqKNWaX9Cb0x0ryNBDw70162G7/8hhWo2immOCXWJXS6CT5UU387722iEXShx T+HxjJ5T6kq+tI9nUY8aWUrXWQI57tN9BucOu+kiVR2cH1+PLOGf9/v+kpGvaTLQ794XFBZVdgN hlxYasZDasn0DlI7MIIRyIGQVFbAs+D7esZ/0q9pXmmwYNIjpprkFybW2xgm2L2yhbldyFT9a37 f90cIStPd0FrI7LZ244QI+cFL0kON5MFvtxQfrkzB/DtMlc29MJFb7ciH5ytYiYMd3cnG75F0SQ pzxUYBtGn5SJhs1i5dUkK7qY0UoFV1QdgEYdrRYCT41jJikD4vSWM6+1/nAlIlUsfYCU+mYBthg HdHP4j8atf3PIRWq/Uy2yv91QWA== X-Received: by 2002:ad4:5ce1:0:b0:896:f588:b2e1 with SMTP id 6a1803df08f44-89979db7595mr208244436d6.61.1771961668410; Tue, 24 Feb 2026 11:34:28 -0800 (PST) Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 References: <4b74f9a1-96d2-4104-abdd-fe56c5e7016c@app.fastmail.com> <585bfc82-a522-43ec-be42-b8945952fe8b@app.fastmail.com> <3cd0d869-5a5b-467c-8eb4-3f8647ba7aa7@bastelstu.be> <6def7a03-eba4-4289-ac4f-0881c5d4c092@bastelstu.be> In-Reply-To: Date: Tue, 24 Feb 2026 20:34:16 +0100 X-Gm-Features: AaiRm50DmD8RKp1r8IbfAWtEAlXmvJCP5Hiz4qjicvnlPKRNCPIj-8uF0dRLJaI Message-ID: Subject: Re: [PHP-DEV] [RFC] Allow Reassignment of Promoted Readonly Properties in Constructor To: Larry Garfield Cc: php internals Content-Type: multipart/alternative; boundary="000000000000cd21e9064b96f9a5" From: nicolas.grekas+php@gmail.com (Nicolas Grekas) --000000000000cd21e9064b96f9a5 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Le mar. 24 f=C3=A9vr. 2026 =C3=A0 20:06, Larry Garfield a =C3=A9crit : > On Mon, Feb 23, 2026, at 1:49 AM, Nicolas Grekas wrote: > > Le dim. 22 f=C3=A9vr. 2026 =C3=A0 19:14, Tim D=C3=BCsterhus a =C3=A9crit > : > >> Hi > >> > >> On 2/19/26 10:49, Nicolas Grekas wrote: > >> > Thanks, I've added new test cases to cover this. > >> > I've also improved tests as suggested on the PR. > >> > And finally I updated the implementation to reuse IS_PROP_REINITABLE > >> > instead of adding new flags + use an approach that doesn't require > walking > >> > the call stack. > >> > PR and RFC updated accordingly, all green. > >> > >> Thank you. The implementation looks much simpler now and the tests all > >> make sense to me and I can't think of any other relevant =E2=80=9Cedge= case=E2=80=9D. > >> > >> I have one more comment regarding the RFC text, which should result in > >> =E2=80=9Cminor=E2=80=9D changes as per the policy of making clarifying= changes: > >> > >> 1. =E2=80=9CSet in child before parent::__construct()=E2=80=9D also fa= ils, since the > >> property slot is not yet initialized: > >> > >> That explanation and example does not seem to be quite correct: It's > not > >> the `$this->x =3D 'C';` assignment that fails, it's the implicit CPP > >> assignment when calling parent::__construct(). The explanation should > be > >> fixed and the `// Error: Cannot modify readonly property P::$x` commen= t > >> should be moved to the `parent::__construct()` call. > >> > >> The test in the implementation was already correct. > >> > > > > Hi Tim, > > > > Good catch thanks, wording updated! > > The RFC is ready then. Any other comments from anyone else? > > > > Nicolas > > Two minor non-substantive points. > > 1. The "supported operations" section all the way at the bottom seems > redundant. That was already specified earlier. > > 2. It could be helpful to include an example of using property hooks in > the intro; there's an example of the other 2 options, but not of hooks, > which are also mentioned as a not-always-ideal alternative. (Let me know > if you want help or suggestions with that example.) > > Otherwise, I'm happy with where this ended up. Thanks! > > Thanks for having a look! Here is the update: https://wiki.php.net/rfc/promoted_readonly_constructor_reassign?do=3Ddiff&r= ev2%5B0%5D=3D1771797005&rev2%5B1%5D=3D1771961558&difftype=3Dsidebyside Cheers, Nicolas --000000000000cd21e9064b96f9a5 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


Le=C2=A0mar. 24= f=C3=A9vr. 2026 =C3=A0=C2=A020:06, Larry Garfield <larry@garfieldtech.com> a =C3=A9crit=C2=A0:
On Mon, Feb 23, 20= 26, at 1:49 AM, Nicolas Grekas wrote:
> Le dim. 22 f=C3=A9vr. 2026 =C3=A0 19:14, Tim D=C3=BCsterhus <tim@bastelstu.be> a = =C3=A9crit :
>> Hi
>>
>> On 2/19/26 10:49, Nicolas Grekas wrote:
>> > Thanks, I've added new test cases to cover this.
>> > I've also improved tests as suggested on the PR.
>> > And finally I updated the implementation to reuse IS_PROP_REI= NITABLE
>> > instead of adding new flags + use an approach that doesn'= t require walking
>> > the call stack.
>> > PR and RFC updated accordingly, all green.
>>
>> Thank you. The implementation looks much simpler now and the tests= all
>> make sense to me and I can't think of any other relevant =E2= =80=9Cedge case=E2=80=9D.
>>
>> I have one more comment regarding the RFC text, which should resul= t in
>> =E2=80=9Cminor=E2=80=9D changes as per the policy of making clarif= ying changes:
>>
>> 1. =E2=80=9CSet in child before parent::__construct()=E2=80=9D als= o fails, since the
>> property slot is not yet initialized:
>>
>> That explanation and example does not seem to be quite correct: It= 's not
>> the `$this->x =3D 'C';` assignment that fails, it's= the implicit CPP
>> assignment when calling parent::__construct(). The explanation sho= uld be
>> fixed and the `// Error: Cannot modify readonly property P::$x` co= mment
>> should be moved to the `parent::__construct()` call.
>>
>> The test in the implementation was already correct.
>>
>
> Hi Tim,
>
> Good catch thanks, wording updated!
> The RFC is ready then. Any other comments from anyone else?
>
> Nicolas

Two minor non-substantive points.

1. The "supported operations" section all the way at the bottom s= eems redundant.=C2=A0 That was already specified earlier.

2. It could be helpful to include an example of using property hooks in the= intro; there's an example of the other 2 options, but not of hooks, wh= ich are also mentioned as a not-always-ideal alternative.=C2=A0 (Let me kno= w if you want help or suggestions with that example.)

Otherwise, I'm happy with where this ended up.=C2=A0 Thanks!


Thanks for having a look!

=
Cheers,
Nicolas
--000000000000cd21e9064b96f9a5--