Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126721 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 2DD811A00BC for ; Tue, 11 Mar 2025 21:17:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1741727706; bh=BaJR1AgUX3FMq/Zo9HENB1+mzpJSTjvxmvmi4pJ8fr8=; h=Date:Subject:To:References:From:In-Reply-To:From; b=Fg23NeBI+kurlSyVg7fRgRf6U8tXnoVY2mW4k6ecVX2qMytDHuNbAzOlxaEeIodv7 Vhg/ra3A2yxB7cCznkaWjfGn0XQBCDo6/QhjygONk5KIQHfi+xqBzhIDj2bSwraj6U Rtp/YN0CX5DmYu3p+Pgv5ikHUGTgdO1Lmwk3wLZwy+8RTneZl9VRxQ67RlU6XP9hPe pyogMP3GITeauPLM0Tkzat2T5NLEBaKGaL5jX9i6el97JwyJ3IBLV6ft5fOozPmyIU 1KwI+u+MbNBPxADbGhk2XksorhgfTydYTVZ7K1nuUbcgpaXZBvXTXQH7+24X4s/UHK UVdzZLH22sErA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 2BF6F1801E1 for ; Tue, 11 Mar 2025 21:15:05 +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=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_PASS,URIBL_SBL_A autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from fhigh-b1-smtp.messagingengine.com (fhigh-b1-smtp.messagingengine.com [202.12.124.152]) (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, 11 Mar 2025 21:15:04 +0000 (UTC) Received: from phl-compute-08.internal (phl-compute-08.phl.internal [10.202.2.48]) by mailfhigh.stl.internal (Postfix) with ESMTP id 643722540118 for ; Tue, 11 Mar 2025 17:17:38 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-08.internal (MEProxy); Tue, 11 Mar 2025 17:17:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rwec.co.uk; 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=fm1; t=1741727858; x=1741814258; bh=kyMW8CHHAV84nW1w4Pa5VxkEWDz/2PMVmK3mwjzu22E=; b= K8gJ7G7/CdYhVQZd0FHrbU8wIKrtndPXp+noW60BDtd/bN+womsCTIl0dXs0O+K3 6TNufMiF4A3461YNGcAkCi3SYfZ5/Acx+XU+hg67I0sR1cVNb7e1gDLOKzY7Fhar S/dtxwHJjuxTxneUnUb1RFIPQOpA1aI0XazjH4U27EnA1WLycVyIBNIeQJOJs4ph Lcea1vE7PPVrn5rSq81fXOks9mvPG6nQ+HrDOqiFw7xHSwtpriYnBmudDcImmSXX otQ/NXzVRpJ+Bkym7I9dOAraTqThZL7lLpuLArhnRWCTzB0FIjNF37z0shdtWvLi wg/mKTuMxepbrTuJI+Av9w== 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-sender :x-me-sender:x-sasl-enc; s=fm1; t=1741727858; x=1741814258; bh=k yMW8CHHAV84nW1w4Pa5VxkEWDz/2PMVmK3mwjzu22E=; b=lLDdaB3VZPGgt+jGU j721PcGmmh+RSsFapibR/3XbzfpYrh/q2tKBub6LCN8TEtU/qMS6YvJiWCNCELXg rwi0YzQ35xG4SPqzhNZ56YFwR77SZrlCTTscJuErK766q7lBy06rb8SAOxYnSoUG r6e41JGK8TfN42sBKB/KmM6KgHpG8wxDmJEVEql5htzsyHGLQb+9foIG6B0ZrRVC EpjruZ6LOnoL8Xe2gfRJqjgg3kJ2IFasiFwTNGPJ1f9PP6F6Ujd+Lj8Xchzu06Y7 qGKikcnZRvScvqwtEO9QhVeeNLN8qsYr/+42t49ep7WBN1rJYo5BIBYSD0OyDEhj HMJcw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdduvdefvdejucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefkff ggfgfuvfhfhfgjtgfgsehtkeertddtvdejnecuhfhrohhmpedftfhofigrnhcuvfhomhhm ihhnshculgfkoffuohfrngdfuceoihhmshhophdrphhhphesrhifvggtrdgtohdruhhkqe enucggtffrrghtthgvrhhnpeefheejgfekveeutdejieejuedvhfeugedtkeefteehtdfh veekhfehvddtkeeutdenucffohhmrghinhepshgvmhhvvghrrdhorhhgpdhgihhthhhusg drtghomhenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhm pehimhhsohhprdhphhhpsehrfigvtgdrtghordhukhdpnhgspghrtghpthhtohepuddpmh houggvpehsmhhtphhouhhtpdhrtghpthhtohepihhnthgvrhhnrghlsheslhhishhtshdr phhhphdrnhgvth X-ME-Proxy: Feedback-ID: id5114917:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Tue, 11 Mar 2025 17:17:37 -0400 (EDT) Message-ID: <95d08053-7500-4cc3-b84b-cb7cc837c065@rwec.co.uk> Date: Tue, 11 Mar 2025 21:17:35 +0000 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PHP-DEV] Consensus on argument validation for built-in functions To: internals@lists.php.net References: <041d1a8c-dd43-4592-b997-ad4d2f91aeac@app.fastmail.com> Content-Language: en-GB In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit From: imsop.php@rwec.co.uk ("Rowan Tommins [IMSoP]") On 11/03/2025 11:54, Gina P. Banyard wrote: > It also means that we need to do *multiple* passes, on the same code path, resulting in somewhat of a code churn and possibly not using a common abstraction. > Considering that we didn't even have the time to properly remove some deprecations from PHP 7 with the PHP 8.0.0 release, nor convert all relevant E_WARNINGs to Value/Type errors, I expect that we would be missing some of them again when PHP 9 comes around. I wonder if in some cases, we could automate this within the source code - e.g. with a macro like WARNING_OR_ERROR(message, first_version_for_error) which checks a compile-time constant for the current version. I realise that still requires code cleanup later, but it means we can't miss our chance when the appropriate version does come around. > and this is ignoring the fact that PHP does not follow semver This is true, but only in the sense that something under the MIT license isn't under the BSD license. Officially, PHP's release policy is extremely similar to SemVer. https://semver.org/ says: > Major version X (X.y.z | X > 0) MUST be incremented if any backward incompatible changes are introduced to the public API. It MAY also include minor and patch level changes Meanwhile https://github.com/php/policies/blob/main/release-process.rst says: > Major Version Number >  x.y.z to x+1.0.0 >   -  Backward compatibility can be broken >  -  API compatibility can be broken (internals and userland) > Minor Version Number > x.y.z to x.y+1.z >    -  Backward compatibility must be kept >   -  API compatibility must be kept (userland) Now, what exactly constitutes "backward compatibility" and "userland API compatibility" can be debated, but there is currently no agreed policy allowing "small compatibility breaks". The fact that everyone acts as though there is such a policy, probably means a rewrite of that document is overdue. A policy that nobody follows is no use to either contributors or users. Maybe we could work on some criteria that could be applied (and publicised to users) about what is and isn't allowed in minor versions. For instance: - Code that already causes fatal behaviour might cause different fatal behaviour (e.g. throwing an Error instead of raising an E_ERROR) - Code that directly violates documented types might start throwing TypeError - Code that produced NULL as an error case only for invalid inputs might start throwing ValueError Some of the cases linked at the start of this thread might then meet the agreed criteria, but some might not. For instance, it looks like pathinfo does give reliable outputs if the flag argument is treated as a bitmask, even if doing so makes no logical sense. It's not strictly the wrong type, and the behaviour isn't obviously attempting to indicate an error, or doing something immediately fatal. So to allow that as well, we'd need some broader criteria, like: - Code that is clearly an error on the part of the programmer might starting throwing Errors But that's probably too broad and debatable to be meaningful policy. Another alternative is to scrap x.y.z versioning completely, and give every annual release equal status. This is the approach that PostgreSQL has taken, I believe. We'd probably still want some kind of deprecation policy - some changes should be deprecated for X releases before removal/change. Which brings us back to some kind of criteria for which changes need that, so doesn't really solve the problem. -- Rowan Tommins [IMSoP]