Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:125805 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 qa.php.net (Postfix) with ESMTPS id AAB121A00BD for ; Tue, 15 Oct 2024 17:11:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1729012448; bh=/vQ2dzR5XHb3g8vPVpQxDgnRV0tOgWkCDFvyg7RENpM=; h=Date:From:To:In-Reply-To:References:Subject:From; b=Q5ycx3+JFsh79GYtVRF0Wh2Edll7iIDJDpV1W3MxREzmNffN2m02oN9fLVKrb6/4r 8UTqkDVwdWwu5wQSu6SsnQ3yelm7vk+BEl+mW3hF2BWvNVSVwVXANNTTn9C1oOooZM NDF9d94sZE53CVKEjVbUMfOaR4QSnIkKESbs1SRLZw0+/hCHrK18O6NeYxqgpqpl2v xl/BmIucSgaTUTH5mgaBNHEGeGbiC3lWj8KYBrOjElAAzKcXu4bKg7jfl7/3oHnT1p es9i+Nfp6EWtsxwboJregcNBeRmnCuM4o9ERsqncR6Xhd9xcAn1KjCh1sJX6pNxBN8 AKSs1p+Cp+OCA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 64B5B18004B for ; Tue, 15 Oct 2024 17:14:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING, RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from fhigh-b6-smtp.messagingengine.com (fhigh-b6-smtp.messagingengine.com [202.12.124.157]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 15 Oct 2024 17:14:07 +0000 (UTC) Received: from phl-compute-01.internal (phl-compute-01.phl.internal [10.202.2.41]) by mailfhigh.stl.internal (Postfix) with ESMTP id 29ADD2540082 for ; Tue, 15 Oct 2024 13:11:46 -0400 (EDT) Received: from phl-imap-06 ([10.202.2.83]) by phl-compute-01.internal (MEProxy); Tue, 15 Oct 2024 13:11:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; h=cc:content-transfer-encoding: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=fm2; t=1729012306; x=1729098706; bh=9lBLjd1XKmpanhHWFIDqL iKR8haQf6GojeUCYZTI8Eg=; b=jEDu+gVMRQ8cjcGRi9YPqkNYnEM9KNg/82G8C ZQS8ybSBmVMSwAXbpaNS0TPUBn9b9JOc5c1y545Xax1A52gZgixp2dbYBGHp25dk LmFRl+6Sds9hpB20AlwNrAcTqGs1Ut7m2hFr5gfSKmPeh/ICDvq4bR3dkI6895ST FkGfjgUNGFWCnvCMGe+g+KvJWbMTHVPB/D3RO9lsKK156dBPT534L7xcI8zR7TD0 pNHAYTlvq/qxyRPvcnvvwHUepTKqcjQcmmEIBUdvXKQlch0SYZish9pTjeF6UKHP a37Um/lwhuvdkk+bBAjB0rQBui9lOib1E9/5dtAtp2fS68ziA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding: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-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1729012306; x= 1729098706; bh=9lBLjd1XKmpanhHWFIDqLiKR8haQf6GojeUCYZTI8Eg=; b=V eQ5Oixtxw39cb9j9saJSGE7jJF975jLeS754eXecVikZZTm8JccT3356x166EsoQ pXSMNVuKcKQg1sEB7XWpLtfYflb91RR8L2ZwuipF7GhytvVJq9TyV6YgJaxksEgR RhHoPFs8VwxwHnXZPV4y59XzpYQbhI6iX60Vo372Dp6ydLA2D50Yq/0eUA68tMsD 47EBFJ4XpBMJGSQX44jFL2obCRDziWGltt/TqzhUyV+UDtpGEIuEuT24GzZwYv8L /encCiXyPUsUQ3DG7+dCOC6ufM42r5TL/V6+Swv6IHgN0g+6XxZu4/hsQbp1nKR6 0ha+U7d5NhuCWR4pvRDrg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdegjedguddtlecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefoggffhffvkfgjfhfutgfgsehtqhertdertdej necuhfhrohhmpedfnfgrrhhrhicuifgrrhhfihgvlhgufdcuoehlrghrrhihsehgrghrfh hivghlughtvggthhdrtghomheqnecuggftrfgrthhtvghrnhepffeiiedvhfdvgedutddt geetieeugeevhfetheeffeefteduiedthedtgeejueeinecuvehluhhsthgvrhfuihiivg eptdenucfrrghrrghmpehmrghilhhfrhhomheplhgrrhhrhiesghgrrhhfihgvlhguthgv tghhrdgtohhmpdhnsggprhgtphhtthhopedupdhmohguvgepshhmthhpohhuthdprhgtph htthhopehinhhtvghrnhgrlhhssehlihhsthhsrdhphhhprdhnvght X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id BA1EA29C006F; Tue, 15 Oct 2024 13:11:45 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Date: Tue, 15 Oct 2024 12:11:25 -0500 To: "php internals" Message-ID: <9399e880-f51d-4726-b4fa-9833e82ef2e0@app.fastmail.com> In-Reply-To: References: <2A7CF24F-3AE3-4125-965F-C65431C42DFB@gmail.com> <30a41608-a1ea-40a9-8d2a-c53c508cd89f@jnvsor.net> <3648840e-5c73-49c9-bc89-105ed761e5c2@scriptfusion.com> Subject: Re: [PHP-DEV] Asymmetric visibility is a BC break Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: larry@garfieldtech.com ("Larry Garfield") On Mon, Oct 14, 2024, at 10:27 PM, Pierre Joye wrote: > Hello, > > On Mon, Oct 14, 2024, 8:07=E2=80=AFAM Bilge w= rote: >> On 14/10/2024 01:02, Valentin Udaltsov wrote: >> > The problem is that in practice most of the PHP libraries consider >> > themselves to be compatible with newer PHP versions. >> > >> > For instance, Symfony PropertyInfo uses `"php": ">=3D8.2"` constrai= nt in >> > its `composer.json`. >>=20 >> That seems like a problem they have created for themselves. It seems = an=20 >> error to me to declare software forward-compatible with PHP versions=20 >> that do not yet exist and thus have clearly not been tested against.=20 >> Being as it is an error, we shouldn't consider it impinges on PHP's=20 >> definition of a BC break. > > > As much as I like this new feature and I am more than thankful for the=20 > work behind it, if a test in codes using a x.y version of php works bu= t=20 > fails in x.y+1, it is a BC break, no matter how we look at it. A php=20 > dependency targeting x.* is very common. While it tends to be used les= s=20 > frequently as the amount of issues increase, that's not necessarly a=20 > good thing. > > In some cases it is a necessary evil (extension deprecated adding=20 > warnings, security fix requiring a bc break, f.e.). > > However, I am very doubtful here. And I do not know if it can be=20 > avoided while keeping the new behaviors.=20 > > All in all, it would be great to at least agree that there is a BC=20 > break issue, so it can be addressed according, whatever the final=20 > decision is. > > best, > Pierre I think folks are operating with different definitions of "BC Break". Consider: // Foreign.php class Foreign { public function __construct(public string $name) {} } // My code: $f =3D new Foreign('beep'); $rProp =3D (new ReflectionObject($f))->getProperty('name'); if ($rProp->isPublic()) { $f->name =3D 'boop'; } Under PHP 8.0, this code works. Upgrading to PHP 8.1, this code *still works* exactly the same. Therefo= re, there is no BC break. Upgrading to PHP 8.4, this code *still works* exactly the same. Therefo= re, there is no BC break. Now, someone edits Foreign.php in 8.1 to read: class Foreign { public function __construct(public readonly string $name) {} } Now, my code will fail, because isPublic() does not guarantee "is writea= ble" anymore. =20 Is this a BC break in PHP? I can see the argument either way, personally, but I tend toward no. On= e PHP version to the next should always be safe to upgrade an *existing*= code base. Just swap out the PHP binary and it should still work the s= ame. We want that. However, once you start modifying any part of the c= ode (including dependencies), all bets are off. Suppose some library switched from using annotations to using attributes= . Any other code that was looking for those annotations is now broken, = but it would be ridiculous to accuse attributes of having broken BC in P= HP. Or ancient PHP 4 code that just assumed all properties were public = (which they were in PHP 4), now confronted with PHP 5 code that has priv= ate properties. Is that a PHP BC break? Not at all. And again, the relevant change here happened in PHP 8.1. This is only t= angentially related to 8.4 at all, because isPublic() has not implicitly= meant is-writeable anymore for three years. --Larry Garfield