Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:130817 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 78FBF1A00BC for ; Sun, 10 May 2026 20:11:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1778443892; bh=zGJVDtBsENtGuYfoVKkBdz92NYPPGPGxIwpIQsuIxzQ=; h=Date:From:To:In-Reply-To:References:Subject:From; b=gOrRYKxwzP5v7V8dFwhl83bjI7aBY+tZsbWdqgXuuskzqyfNh0MR0xeHu0tqr3896 +WxJJr/0fgb9ZKUk+FnZWobeJDdjhYE6hcwROrUsq/GLLBlCN8Dyn0i10ic9mW8KcD UoHeGVJa4B7m86egZwOe2N2ZxgqXLh7XArCjtwLqYv7K7mkzE0yLQLKpU+cAUOTYlC AHa4RBooNWBds3zvk6N9RWM3lzwmP7KvZS1oKCO9FcAmv3c46L6eS7xRZaO9+BhJe3 1E2U/f4rsCqT0w32ozwid4ycsPAZZvsi8gh2Coz3C1MeST6ScerqvwirMOO7+JNErx kEVxppgGFCJmQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 05101180068 for ; Sun, 10 May 2026 20:11:31 +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=-0.1 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,HTML_MESSAGE, RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from fout-b7-smtp.messagingengine.com (fout-b7-smtp.messagingengine.com [202.12.124.150]) (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 ; Sun, 10 May 2026 20:11:30 +0000 (UTC) Received: from phl-compute-12.internal (phl-compute-12.internal [10.202.2.52]) by mailfout.stl.internal (Postfix) with ESMTP id 34B1E1D0004C for ; Sun, 10 May 2026 16:11:25 -0400 (EDT) Received: from phl-imap-14 ([10.202.2.87]) by phl-compute-12.internal (MEProxy); Sun, 10 May 2026 16:11:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bottled.codes; h=cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm1; t=1778443884; x=1778530284; bh=VKRNvfqqUL g548MS9RQ4dpTZGQewfLqJwtgqz19R8qs=; b=QeLDJgpdXLu6rOy4TxFXBYQ2u+ +EUfKCcuABqRbjbclBUct5R9cu7ZLDB71o+F86N+/qkKnziBaFZPBdhfOuAnaraE d9NdbNah4JG+txtJ+xbpp1QVb/j0rZnyU4kVw8ghTAyCDllxbh5oTmIheY9dEL/y gskwcIfBQR951AWrdtFhab0espKLn1aP9lFNLqQZUl2SuuaVSou87OQymMT13Don 2CXKdSJPenp0Co9cnRTip52K8Njo4yLpH/NUGEiVXAQ+oMykRqij3TNXLnKOkyGG 2wKMYMayQJTftivyo2L/ntauST4DfyN2cJIjDhjA0FSd8hE1OgS6oUIbh7/w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1778443884; x=1778530284; bh=VKRNvfqqULg548MS9RQ4dpTZGQewfLqJwtg qz19R8qs=; b=gqxrD6KBhS0ZEz/rFER3jV8ImEN8Sy64yCBb6d2w1Y+U6hDOe46 E8DYIrzqDWrwk4pOCr5/AfYHl0GuGCgoAsgtJSKBrC3hYx6XW/Dk4O1JUIyIY4GQ 0PvO6jLN/ZrSIuIqiSsw8NQ1s3bTYIkgSS20SiK32rSpFaQtYmH1qHRE/0kd7ms6 Vr2OY4nn4uXg9vZg3KVit+ZTTdq53WHjl+3ECuU6Tpn3fbsg9Bpd4P7VKvVCBI9R 9rJW9przxCVWU0ExZM9f7YKbllpP//XFUONvErZPo4NJB7wZqbAXVgZ2FN7P2u0g iW8ncZPevfDN+mRDaub/Hk5ocEgvsJep9LQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefhedrtddtgdduudejtdefucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucenucfjughrpefoggffhffvkfgjfhfutgesrgdtreerre dtjeenucfhrhhomhepfdftohgsucfnrghnuggvrhhsfdcuoehrohgssegsohhtthhlvggu rdgtohguvghsqeenucggtffrrghtthgvrhhnpefgvdfgheetheegtdelvefhffejfeethf evvdeijedvffekgfduudeiledvteehjeenucffohhmrghinhepvgigthgvrhhnrghlshdr ihhopdhphhhprdhnvghtpdhgihhthhhusgdrtghomhenucevlhhushhtvghrufhiiigvpe dtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehrohgssegsohhtthhlvggurdgtohguvghs pdhnsggprhgtphhtthhopedupdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehinh htvghrnhgrlhhssehlihhsthhsrdhphhhprdhnvght X-ME-Proxy: Feedback-ID: ifab94697:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 8EA26C4006E; Sun, 10 May 2026 16:11:24 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 X-ThreadId: Aj6KNgTsbv3- Date: Sun, 10 May 2026 22:10:42 +0200 To: internals@lists.php.net Message-ID: <7e84847b-f857-47e1-be21-2784f1821674@app.fastmail.com> In-Reply-To: References: Subject: Re: [PHP-DEV] [RFC] [Discussion] Friends Content-Type: multipart/alternative; boundary=cfa845b9ced66d9fc7a4a104b27cfaeed5999898 From: rob@bottled.codes ("Rob Landers") --cfa845b9ced66d9fc7a4a104b27cfaeed5999898 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Sun, May 10, 2026, at 18:28, Daniel Scherzer wrote: > Hi internals, >=20 > I'd like to start the discussion for a new RFC about adding friendship= in PHP. This is a follow-up to a pre-RFC discussion thread https://exte= rnals.io/message/130710. >=20 > * RFC: https://wiki.php.net/rfc/friends > * Implementation: https://github.com/php/php-src/pull/21937 >=20 > Thanks, > -Daniel Hi Daniel, I worked on the namespace visibility RFC before running out of time, and= life isn't slowing down anytime soon; thus I wish you the best of luck = with this one. First of all ... the RFC doesn't address several inheritance/override in= teractions worth working through. I'd invite you to read the thread here= : https://externals.io/message/129147 -- you're going to run into a lot = of the same issues in this RFC (and especially the follow-up namespace o= ne), and you have some of the same problems. Take this example: class P { friend F; private int $x =3D 0; } class C extends P { protected int $x =3D 0; } class F { static function set(P $p, int $v) { $p->x =3D $v; } } F::set(new C, 5); // fatal The friend grant on P creates a non-local invariant that subclass author= s of P can break without realizing. C's author, adding `x` for their own= internal reasons, doesn't know they've broken some F that depends on th= e parent contract. C's tests pass. F's tests pass. Integration breaks at= runtime in production. private(namespace) had the identical pathology. =E2=80=94 Rob --cfa845b9ced66d9fc7a4a104b27cfaeed5999898 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
On Sun, May = 10, 2026, at 18:28, Daniel Scherzer wrote:
Hi internals,
I'd like to start the discussion for a new RFC about adding = friendship in PHP. This is a follow-up to a pre-RFC discussion thread&nb= sp;https://externals.io/= message/130710.

=

Thanks,
-Daniel

Hi Daniel,

I worked on the namespace vis= ibility RFC before running out of time, and life isn't slowing down anyt= ime soon; thus I wish you the best of luck with this one.

=
First of all ... the RFC doesn't address several inheritance/= override interactions worth working through. I'd invite you to read the = thread here: https:= //externals.io/message/129147 -- you're going to run into a lot= of the same issues in this RFC (and especially the follow-up namespace = one), and you have some of the same problems.

T= ake this example:

class P {=0A  friend F;=0A  private int $x =3D 0;=0A}=
=0Aclass C extends P {=0A  protected int $x =3D 0;=0A}=0Aclass F {=0A  s=
tatic function set(P $p, int $v) { $p->x =3D $v; }=0A}=0AF::set(new C=
, 5); // fatal

The friend grant on P create= s a non-local invariant that subclass authors of P can break without rea= lizing. C's author, adding x for their own internal reasons, doesn't know they'v= e broken some F that depends on the parent contract. C's tests pass. F's= tests pass. Integration breaks at runtime in production. private(namesp= ace) had the identical pathology.

=E2=80=94 Rob=
--cfa845b9ced66d9fc7a4a104b27cfaeed5999898--