Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126713 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 ED2A21A00BC for ; Tue, 11 Mar 2025 10:21:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1741688325; bh=ggDjU5GGHhtiwGYs87jOGxHcQUWSTBlilFUmBy9jjC8=; h=Date:From:To:In-Reply-To:References:Subject:From; b=Sh6pYcy0xlOL9Aq6UMA+wAnrWtqRb/uZv6aEvlWRDZdSprrElrVb8tVIuHODWqc3q Mx1ur3YXiflD+5kO68aMdIzd5ce9wNO+Bt/Mv6WcBUBj9kVfGdXRV58jO9OXkoBX5V s3Sj/ucegxwDcukhCdJsPwrsri4B8DKIlqA2dIyMS4G5LG32mojhYCi3yXfV9PlLKR K2nvrW6zfG1fG4jYz+FaFaam+2RO1SNEf/dNu1A6mLpW+roxv4zMrz6FFDRGuwL8CO /8MEtiWtsaHBzOydvephNMHv05dPEbg0JUXQwgFcFZUO7SivPVrYCaVXxceWXAaMYG MOfohFHR69m0Q== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 24C80180071 for ; Tue, 11 Mar 2025 10:18:44 +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.8 required=5.0 tests=BAYES_00,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.0 X-Spam-Virus: No X-Envelope-From: Received: from fout-a8-smtp.messagingengine.com (fout-a8-smtp.messagingengine.com [103.168.172.151]) (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 10:18:43 +0000 (UTC) Received: from phl-compute-11.internal (phl-compute-11.phl.internal [10.202.2.51]) by mailfout.phl.internal (Postfix) with ESMTP id 6FAE31382CEF for ; Tue, 11 Mar 2025 06:21:17 -0400 (EDT) Received: from phl-imap-09 ([10.202.2.99]) by phl-compute-11.internal (MEProxy); Tue, 11 Mar 2025 06:21:17 -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=fm2; t=1741688477; x=1741774877; bh=ggDjU5GGHh tiwGYs87jOGxHcQUWSTBlilFUmBy9jjC8=; b=k1YI3ksTk+O+urMVgaP2tc3hCg OEJR7THB+xGKoua6QxF8YfyR0zuaNAvpoRFbAzalxLoRZCYzbewaqD6ih2NSTaqj nOoIhe4lWZUTwHllRp5tUCcgpLmpKHac3Z5OXvoZtnJkETc1Gw7N9pBH/rVpC4Ic tXsbNrkvQouMGUQhSmbYJCLlfQ9iDA8FH8++r/xxaPDS50hxWgPcA4xDd39y3nYj FJE3zIaijPYuDSghy6uwd+ztAXhb3nM+qcCjQZNNa8/kF+SchxZKT5ePiEC8pwvx 1H10fKqKD8KA664Czf2aQ1/vpqSxhKf/fSWVgGL8wkSGI/PYgzHlTCm3IOGg== 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=fm1; t= 1741688477; x=1741774877; bh=ggDjU5GGHhtiwGYs87jOGxHcQUWSTBlilFU mBy9jjC8=; b=7cQ2cgaqVxszQ9e0zRnlFTqWI4NikX/xu/foR51r8YEE1Q6O3Fr 7jPWsSv/R8+MK6oHEGMfN5E9vhCUkKtEZayHM5v/s3At8/mD4RMHsBwnhMSUkroI TiRvfmM63SUrnTw+QSTRIQ5vd6elOiHCW4WYDODamJSGotECnbmpPKztxNf+m3bK pTpSVexceWe/Sjw4BHyMqTqsU+j2p9ZZhbp9sgBbvS5KdJFCl3h2JZqDNAB6jnh1 mpLoIv0gg9VSms6c84jLeMKLJdIaLOQa7IfvPhiQf410ZUBc/WdXr0nEkXyFjB9l Dj9bckybOEJCd/9XmTKtjkzDWbB+MUluxMw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdduvdduleejucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefogg ffhffvkfgjfhfutgesrgdtreerredtjeenucfhrhhomhepfdftohgsucfnrghnuggvrhhs fdcuoehrohgssegsohhtthhlvggurdgtohguvghsqeenucggtffrrghtthgvrhhnpeeitd fhhfdvfffhtedtgfevfefgueeggeduueekjeehieeggffhieevleeffeeufeenucffohhm rghinhepghhithhhuhgsrdgtohhmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrg hmpehmrghilhhfrhhomheprhhosgessghothhtlhgvugdrtghouggvshdpnhgspghrtghp thhtohepuddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepihhnthgvrhhnrghlsh eslhhishhtshdrphhhphdrnhgvth X-ME-Proxy: Feedback-ID: ifab94697:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 1747C780068; Tue, 11 Mar 2025 06:21:16 -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, 11 Mar 2025 11:20:52 +0100 To: internals@lists.php.net Message-ID: <041d1a8c-dd43-4592-b997-ad4d2f91aeac@app.fastmail.com> In-Reply-To: References: Subject: Re: [PHP-DEV] Consensus on argument validation for built-in functions Content-Type: multipart/alternative; boundary=e13ec0499d3241998b31de2aacdb3f78 From: rob@bottled.codes ("Rob Landers") --e13ec0499d3241998b31de2aacdb3f78 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Tue, Mar 11, 2025, at 10:07, Christian Schneider wrote: > Am 11.03.2025 um 07:32 schrieb Gina P. Banyard : > > On Monday, 10 March 2025 at 23:07, Jorg Sowa w= rote: > >> I=E2=80=99d like to align on the approach to validating arguments f= or built-in functions (usually for flag inputs). Some ongoing discussion= s in PRs: > >> - https://github.com/php/php-src/pull/15647 > >=20 > > My opinion on this topic is well known, validation errors should go = straight to a ValueError. > > And if not a ValueError then it should be an E_WARNING. > > Raising a deprecation is frankly non-sensical. >=20 > I'll sound a bit like a broken record :-) >=20 > The very first example shows why we should have an E_WARNING phase to = smoothen BC changes: > Code like > $a =3D array_filter(["a", "", "b"], strlen(...), 666); > which currently ignores the bogus value and allows the code to continu= e would suddenly stop with en Exception. >=20 > Fixing the code is trivial and a warning helps identify those code loc= ations but decoupling the moment of upgrading PHP from having to fix all= code is IMHO still valuable. Especially when using third-party packages= which might have a delay in fixing it. > I'm still waiting on some packages to fix new warnings for PHP 8.4 eve= n though we've upgraded to the new version already. >=20 > Conclusion: > Yes, I'd very much like the 1) warning 2) ValueError approach from the= original mail to be the default. >=20 > Regards, > - Chris >=20 Well, when you make it an exception, it usually gets upgraded/fixed fast= er :)=20 =E2=80=94 Rob --e13ec0499d3241998b31de2aacdb3f78 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
On Tue, Mar 11,= 2025, at 10:07, Christian Schneider wrote:
Am 11.03.2025 um 07:32 schrieb Gina P. = Banyard <internals@gpb.moe&g= t;:
> On Monday, 10 March 2025 at 23:07, Jorg Sowa <= jorg.sowa@gmail.com> wrote= :
>> I=E2=80=99d like to align on the approach to va= lidating arguments for built-in functions (usually for flag inputs). Som= e ongoing discussions in PRs:

> My opinion o= n this topic is well known, validation errors should go straight to a Va= lueError.
> And if not a ValueError then it should be a= n E_WARNING.
> Raising a deprecation is frankly non-sen= sical.

I'll sound a bit like a broken recor= d :-)

The very first example shows why we s= hould have an E_WARNING phase to smoothen BC changes:
Code= like
$a =3D array_filter(["a", "", "b"], strlen(...), 666= );
which currently ignores the bogus value and allows the = code to continue would suddenly stop with en Exception.
Fixing the code is trivial and a warning helps identify tho= se code locations but decoupling the moment of upgrading PHP from having= to fix all code is IMHO still valuable. Especially when using third-par= ty packages which might have a delay in fixing it.
I'm sti= ll waiting on some packages to fix new warnings for PHP 8.4 even though = we've upgraded to the new version already.

= Conclusion:
Yes, I'd very much like the 1) warning 2) Valu= eError approach from the original mail to be the default.
=
Regards,
- Chris


Well, when you make it an exception, it u= sually gets upgraded/fixed faster :) 

=E2=80=94 Rob
--e13ec0499d3241998b31de2aacdb3f78--