Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129988 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 EF1F91A00BC for ; Tue, 3 Feb 2026 08:56:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1770109007; bh=YsEO5Oy8UaMe9XFW5f8qBOLE/n0b+V81TD6Z7UOfUnQ=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=cm0HLgA2H22RMXs3eU1MdMeY6gXoLCaaYf0VqRQf7EfME1L4VLmPj/oaVtFNK2rpL qSgFCN8qYk+QthlTkP9D4PzdDljOihFZCmU6mo067tQHsmVeX8n4S/Jffresn6uSjZ TImiDej96903vTHF7LlF/Lico147OGtdgPYfgY+FTfieZZiURDG12N0FppgxQGUxmb xZLdksPJQSAT+DEV707SMbtC7BjTfYZqDSs1IPK4SR+k1t963dTt6kuY3tc5d8s/Le 99hsCuv+xCpXFwLK3Iz/Qf7B59nE44XaA5gn2E11xO0zJF4+6u88UINm+/83cc9MIE 1lVjBzQnGDOjQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id BC68618079F for ; Tue, 3 Feb 2026 08:56:46 +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=2.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,FREEMAIL_REPLY,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, 3 Feb 2026 08:56:46 +0000 (UTC) Received: by mail-qv1-f53.google.com with SMTP id 6a1803df08f44-895071c5527so30834256d6.1 for ; Tue, 03 Feb 2026 00:56:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1770109001; cv=none; d=google.com; s=arc-20240605; b=IY8MMpTm2zDG1uWv4jxwSWUAs0LILCiTnH+ohiQnBGH3ftdbQv9BNA/KvMSTecmSMQ JorRK/fru++rsR33xbhIPwCFHTaLNRfRceMgANNSPYfg4g/2CgrZHOOI95EaGyWWg3Dw qu7MfUVYTTtSGAEpQE6B6wKWvo83SBA0jv3AhXZfi4PKrJ0qRF+S6HxyQFSM0E/D8emV wIb21R73ROoTvOo341C0OhkVUj0+TcmyQUFbkH9uOlFG4Inm4LgCoBXbLe6I/800vHGD E1hlxPpTdc5ReULLyv/uFNBFirym4s+jvC6Jh2Aa3d1fpBJHD6Knrh6lK2O8jrRtOUx4 VQXw== 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=YsEO5Oy8UaMe9XFW5f8qBOLE/n0b+V81TD6Z7UOfUnQ=; fh=NauCm4jsxCwrDUWKopy7EgFmshK/3zuubIFdTiA9vLI=; b=hbfEqk9K0YdX/Q2U7UKqeQ5AV6BV84x0g0ekt8edNd/83CZrJrBVgMqZFuCfO4JXqH UvVpXEbQ30glF4OY1T1Lbiyz80zAY7+h476PefcylHB+IK3SapaiYttsKp4IveWczM2I Go9Qn/Ie6+tOzDVgoNPSaFG2sBcLY4bt4J7cyjJscau4zMfHKCQhNAYVYg4x9DVFc+5m py639+MdKO1T1wIhqy14em8BcmnslKQxXi3s48P1LsMMqfdpGvA9ldJFF+3nSVPAxu9y FeNXG71VXfCJmBIzj41pdMCVKeX1Qmo9D0Iz/oQebpGAaIBOeU4wMSItPrvtZ3AQoaGr ZjXQ==; 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=1770109001; x=1770713801; 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=YsEO5Oy8UaMe9XFW5f8qBOLE/n0b+V81TD6Z7UOfUnQ=; b=FNnA+bIiKmI1tlGghzN9eEv9INXMjdL0WyS+0np0SrkTV8CgLzjHn0rFMkyRWaU6Wf tHVZmvI4ILNd2LPjl0v0suonqL5XR7FdrCtE5jcTq/iPArIdnzJjqZKVj0rgXlKzgjHU yIaiHRG9VZLS4p4xQYqnmQEPqt8stIEzLdDjf7r5z7PNU9j/weugWIqLID8zVwo3Ndak Kk91aaR4UyCRFgG8GE4Y8DTb/VTp0gtV+6bpR2oCMvHjDDVxKuVjcxxaSThOtQb/mCy9 TSoEfFWP70O9kOASVVd5UmANt2NuKV4MVX6Kp32Dpuaa1OPL0eCTcFoSjCBx2rwppHJb X5OA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770109001; x=1770713801; 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=YsEO5Oy8UaMe9XFW5f8qBOLE/n0b+V81TD6Z7UOfUnQ=; b=FdXVcd5FGu9KNHlAQydyy/NwyuIqe1fQUnCLr+Ln/pADy3IydBF0BtEyf3q87HKDXG csbBfRzBUuIbqXOx1ivv3/anRq5vf/Uoyqei21jNLYQfNcUWMmRS1PyMqBb5GMhsU576 ksdOcMoE+bJqFk4aJS3uoQlMrwJ+nFh2URUZJdXLibCU0w6V5EhtUKGJitMZ91DuwSwX GKf1uIAuIegyiI427oiAbe7dbz1b/3JE6JTw1NRNJx7RySu0uIUhQxtA0hEkKiBaimiw ChVwxN1y9DzrpwMriHzRzSzlg+DhOURS4FdvUxS00xp4Fm/tRHEanH7bk55CyK/Rx7nu YvrA== X-Gm-Message-State: AOJu0Yy0KYF7IVbmEDFCqmHLw9Kf4zDWYUEEa1XTlQqtiE9DeuJ3Ea6D hKZ0d9w2GJHC6PHx56VY/EX7W0YS/xiTJyD7b4wgGNOcLg0GvgxvDR8fXfzHRWcnmJiLpZahN5v sKGxJrgrhW8E/DaF3Ya49M9SXi7JgDgtX7x11WKg= X-Gm-Gg: AZuq6aL408G+zv/6rr8FiKNL2YljFyge/SE+4R4MCRTtu3m+UWTCJhOKtr5o0l5psks UnlICcPoswqwaEhmJMEADFUw9gIQwOQXgQax0FHDzj2Qba3DFg++PdiQagJ+oeLF8VbUDkidzZx 3620Xn7M7XRrojOx90k3AkRd3g00uzcIML1mvRdENj8eZay1DH+y1YcaoxAPXJ0sAzQQRRCPtN8 /tFIzbnkJesR+tCtqlN8LAnfjzpAjWxsMFz5nIseZGZ3hvpSmEGnGHAV8JemNQ3hjnM3jFU/JtM P4ZQ912Vcx94M6pG4XFyo1Upot5TTWGukfcenYJuyI/BUHdJ4dpjZ/xI X-Received: by 2002:ad4:5d4d:0:b0:895:829:4852 with SMTP id 6a1803df08f44-89508295985mr107468736d6.36.1770109000600; Tue, 03 Feb 2026 00:56:40 -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> In-Reply-To: <4b74f9a1-96d2-4104-abdd-fe56c5e7016c@app.fastmail.com> Date: Tue, 3 Feb 2026 09:56:30 +0100 X-Gm-Features: AZwV_QiLvGiqInjBZjrXobHbxfRDveWedq8dvlsND6C5Bncrya1QzV-acnn3pSk Message-ID: Subject: Re: [PHP-DEV] [RFC] Allow Reassignment of Promoted Readonly Properties in Constructor To: Rob Landers Cc: PHP Internals List Content-Type: multipart/alternative; boundary="00000000000031d14f0649e79e46" From: nicolas.grekas+php@gmail.com (Nicolas Grekas) --00000000000031d14f0649e79e46 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Rob, Le mar. 3 f=C3=A9vr. 2026 =C3=A0 09:50, Rob Landers a = =C3=A9crit : > On Mon, Feb 2, 2026, at 22:14, Nicolas Grekas wrote: > > Hi Marco, > > Le lun. 2 f=C3=A9vr. 2026 =C3=A0 11:54, Marco Pivetta a =C3=A9crit : > > Hey Nicolas, > > > On Thu, 22 Jan 2026 at 16:34, Nicolas Grekas > wrote: > > Dear all, > > Here is a new RFC for you to consider: > https://wiki.php.net/rfc/promoted_readonly_constructor_reassign > > > > What happens if one calls `$obj->__construct(1, 2, 3)` (on an already > instantiated `$obj`) in the context of this patch? > > > Thanks for asking, I didn't think about this. This made me also think > about ReflectionClass::newInstanceWithoutConstructor(). > I clarified this in the RFC, see "Direct __construct() Calls Cannot Bypas= s > Readonly" and "Reflection: Objects Created Without Constructor". > Patch and PR updated also if anyone wants to run some code where this RFC > can be played with. > > Cheers, > Nicolas > > > Hi Nicolas, > > Under "Child Classes Can Reassign Parent Properties": this feels like a > major footgun. Calling parent::__construct() won't allow a reset (per the > rules of calling a constructor directly); which would completely break > inheritance... but then in the examples it says that calling a constructo= r > directly can reset it -- but you can't? > > This feels really inconsistent to me. > > =E2=80=94 Rob > Yes, the text was ambiguous. The implementation allows parent::__construct() during the initial construction (normal inheritance), and only blocks explicit __construct() calls after construction completed. I=E2=80=99ve clarified this in the RFC. Nicolas --00000000000031d14f0649e79e46 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Rob,

Le=C2=A0mar.= 3 f=C3=A9vr. 2026 =C3=A0=C2=A009:50, Rob Landers <rob@bottled.codes>= a =C3=A9crit=C2=A0:
On Mon, Feb 2, 2026, at 22:14, Nicolas Grekas wrote:<= /div>
Hi Marco,

Le= =C2=A0lun. 2 f=C3=A9vr. 2026 =C3=A0=C2=A011:54, Marco Pivetta <ocramius@gmail.com>= a =C3=A9crit=C2=A0:
Hey Nicolas,


On Thu, 22 Jan 2026 at 16:34, Nicolas Grekas <nicolas.grekas= +php@gmail.com> wrote:
Dear all,

Here is a=C2=A0new RFC for you= to consider:

=

What happens if one calls `$obj->__construct(1,= 2, 3)` (on an already instantiated `$obj`) in the context of this patch?

Thanks for asking, I= didn't think about this. This made me also think about ReflectionClass= ::newInstanceWithoutConstructor().
I clarified this in the RFC, s= ee "Direct __construct() Calls Cannot Bypass Readonly" and "= Reflection: Objects Created Without Constructor".
Patch and = PR updated also if anyone wants to run some code where this RFC can be play= ed with.

Cheers,
Nicolas

Hi Nicolas,

Und= er "Child Classes Can Reassign Parent Properties": this feels lik= e a major footgun. Calling parent::__construct() won't allow a reset (p= er the rules of calling a constructor directly); which would completely bre= ak inheritance... but then in the examples it says that calling a construct= or directly can reset it -- but you can't?

Thi= s feels really inconsistent to me.

=E2=80=94 Rob

Yes, the text was ambiguous. The implementation allows parent::__c= onstruct() during the initial construction (normal inheritance), and only b= locks explicit __construct() calls after construction completed. I=E2=80=99= ve clarified this in the RFC.

Nicolas
<= /div> --00000000000031d14f0649e79e46--