Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:130278 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 03B8C1A00BC for ; Mon, 9 Mar 2026 13:53:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1773064387; bh=FSZTwqSCNd6oqieziA3I8MDqLQrmHRykoNAAyG3t9bA=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=noydVB3hR8bAiEAxgXlvH1IOwSSTt9KTZfLBDXdwoc5TWFliKXn4YKPOmhRlVgVux 31ZlkK+H6AOJs3lbfLTd0zYCkjqn+IHtRe0rPhdw8WDFsGjAZvFCAt4op5NX+EzGmc moKwFZ6FfV+1lurP4BC0M9LAFaHgFVUkP0qp7Dg3KWR1h2zakQ6ttJ1B4nVzv5qLgn zPR7QCX+y4nHuPCCYt+QEQqtIUH51jNmWHMHFMJ060xjCUJyBKnUmBIYsMaK4TWGOw QqTIHiLUgGhcPUvOCY+yWj27PLSUbrFV2cyNJS5Vww3/m4RVIxCNKxqOSjaNd74xVj B4yuZ+uCGBc4Q== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id A44F01801E0 for ; Mon, 9 Mar 2026 13:53:06 +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.9 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_50, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,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-lj1-f180.google.com (mail-lj1-f180.google.com [209.85.208.180]) (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 ; Mon, 9 Mar 2026 13:53:06 +0000 (UTC) Received: by mail-lj1-f180.google.com with SMTP id 38308e7fff4ca-38a2e62b893so42370621fa.1 for ; Mon, 09 Mar 2026 06:53:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1773064380; cv=none; d=google.com; s=arc-20240605; b=E1Sxb5m+NKVlXs3zxMl0LXRDHmOk4pS9Ry1scC8v0uSUZYQeS571+rFDYLXk9qtytn GAQfjAvb8IGjwnyG4NHYtfaQ7vxVMkyt7H9cXybCyBRfQSMaIKZLIWeq6dEeKIAmxice HiOOA7rkwr9yJz/YsapCilb/LYpfcui2EVGxUOAbd8U89A42GEuphnXpHwKFHsmgQtqA MMBedgruNlcZeOLgeEgmd58AixOonAhQOSm3t96z6Wa+7awt/nhmTRd3XulGIV9/JF+/ r4QRnmTRxB8fauoXgqo2k3Us39j3FSWXqY8T2Yzc1hqm1ZZYJhOVVE5J3LZEDRYGFPCz di6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=vFKDTxAFCA704Sn6D2r7TpcnwnNAgZlyOmS3Sv7HVB8=; fh=F34kJHmFdI4/u3IF774OGQbWEFUaIkTg/ve/4QVrfTs=; b=KLmabW8QeS9iExF3sBXpVvT/PlC32Ej4e1b3AQ9dd30zjQ/EeswQTyxMK132uwLdOf EL8jysO6zeX51FF6IJi9bRU+Od6UzSjit79Ll36Rvs0edvaJIUIlWTub4NxwAhGH681y u6GuTdPtivSt7ijAOr6icc+k2oEEH3R+d/CR1IvpfEnLm7Zo6Yt8miJrOaBgOPC2VmZB +L8eC3BUcj7Fgq3Pi54Xdi3ADvvtFg/HvD++wWQ0jcXY/HMJUihQNan9yMXLo0qB63L/ OrbqoZCHRgREb/47eoU6+XQnONY6t2C+47jhQUeBRWDpkxoQMYEsjEz+gLLRVnKExA0k WviA==; 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=1773064380; x=1773669180; darn=lists.php.net; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=vFKDTxAFCA704Sn6D2r7TpcnwnNAgZlyOmS3Sv7HVB8=; b=aRyes7pe8i+Z82pPxlKU+37naPq1UrYYuKohFhszTqv6ZSMFqA99+TvTQED/CgUfge 5NNlBa8UUGYVV5YYKuyBKxvq7C1fbH1nDev4swlZINC405FOh9dQkTlonSxt12Hrg4ij XWkdnA9uztRhr2aErM708UmfpIptl6ZBZ/c5F2Cwb3JwUHZjiMSELSqn+wCsJNp7G+1l V4dXyjpsWqiARdoWKf/4T73QE21Ks7V+A/CHIVNh6iPZ7tRZvwS22G6cqfKjg1Ra0QLb ynQ3U7nu2wX4u0+69kaa6hc8KdPhN25C/Yi96u/2q8gcDvwarn2dVpa7ICxQc8Mv7HnT nZvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773064380; x=1773669180; h=content-transfer-encoding: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=vFKDTxAFCA704Sn6D2r7TpcnwnNAgZlyOmS3Sv7HVB8=; b=BEzGCJNnCOV6SgSh9TjoNppkaw9x5pnkxaXV8W7pTPrN8XtaQyL78UW6deEesVDk5l 10zViljI0UFK30Y5ZhPp9ZdRLUcEVx3Bs3wXH0hNTGaA0MnaHZQh/TmN/W1M7YKp7qb4 jRMuBsgTOeG857vgE5o6E28Hatzn+/P/7w7Nz4f06zJ4vVvI/w9XL5ekHKivAYAJsXeu vTUckTAU1jYyHTO4y1EAzDgzv4XoLja/yN7VZ0FPmdVPvSU2gqm9of5SAz3yuQXLEgHC ALgnF9yspjfFNqq9+k3u9dGfZERUY/TR62gSx9slpzbKWIXmhot7QFPMjhvAm81kK6HX rHjQ== X-Forwarded-Encrypted: i=1; AJvYcCVKKVSENE11PTroVYtZJyCeWlacRrpAgllkTjL/0mHj6EWcd5twVDSl2WQRKvGH/Gw7kMpky3BFuV4=@lists.php.net X-Gm-Message-State: AOJu0YwIiKjo3hqil+uW3nBdKNfQeukKo1xK+/4EpRIPJOuY7a0njBNL wh1XvTyvKUQNmuuhdbYgGUezcTY04ip9JKzIH/wGOxsAGoSJ6M5S2kcez9AwAGH//xDJQ+Jp6T9 /mx9qIpNIA/RE3Uq2d2cvL7dU0H7L8zaxKA== X-Gm-Gg: ATEYQzzN+FLliT8rIrxTUd5HCbLeSQk6JmynBhuNg6OPUM3kii4a6SJnQ6j4bhucSoP q/XXa9bdCMsIoAuAtcTLz7YcQdcQQGL/uTvC8/yqk/m5ge+R4mA+CZ65pVDrX9Yu2wtt0pusZtP Jz4jQgw90FdhJo2IJERHJvw2pfLWH00vk4cdyrTUk4TGS3Cyozwr7p/nJSDxIDxhzA/cqHradwS yHGeSUMAAVg4Do4UU+E6RKQRx6nAsfMJGzaRuycBalVr6MZ2Cg3hj4o4+75LxbpqKbfuy30cDoK /K4Zsjs= X-Received: by 2002:a05:651c:2122:b0:38a:4197:862c with SMTP id 38308e7fff4ca-38a41978929mr37745321fa.9.1773064379568; Mon, 09 Mar 2026 06:52:59 -0700 (PDT) Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 References: <650FCF24-CDBD-4F37-BA50-6D691EE3E3E1@cschneid.com> In-Reply-To: Date: Mon, 9 Mar 2026 13:52:47 +0000 X-Gm-Features: AaiRm50tulRO1_w6wuYbgS2ufMhcnqK_a5orokCAS7haqyhAu9L7IGX7n4UU5js Message-ID: Subject: Re: [PHP-DEV] [RFC] Exempt input type and value validation from BC Break policy To: "Gina P. Banyard" Cc: Christian Schneider , PHP internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: tekiela246@gmail.com (Kamil Tekiela) On Mon, 9 Mar 2026 at 13:37, Gina P. Banyard wrote: > > On Monday, 2 March 2026 at 19:54, Christian Schneider wrote: > > > Am 02.03.2026 um 20:12 schrieb Tim D=C3=BCsterhus : > > > On 3/2/26 14:49, Christian Schneider wrote: > > >> Playing my favourite broken record: > > >> Can we please state that additions of Exceptions should (in most cas= es) go through an E_WARNING phase to allow a time window to fix code before= changing the behaviour? > > > > > > =E2=80=9CNot passing invalid values=E2=80=9D is perfectly backwards c= ompatible. Folks can just fix their code before upgrading their production = deployment to the new PHP version, e.g. by trying out the new PHP version i= n a staging system or running CI for both the old and new PHP version. > > > > - Not everybody has access to a staging system, e.g. people running stu= ff on hosting services. > > - As a hoster I'd rather have a phase where my customers get warnings i= nstead of errors, creates less emergency support load. > > > > > In practice an E_WARNING is no less breaking than going straight to a= n Error, because: > > > 1. The common frameworks include error handlers that just convert any= warning and notice to an Exception. > > > > So in that sense there is also no advantage to NOT having a warning pha= se for those people. > > But people treating E_WARNING different from Exceptions (which is proba= bly the exact people whose code breaks with an immediate Exception) do have= a time window to fix things. > > > > > 2. The code is already broken, because it relies on unspecified behav= ior. The error would just making the user aware that the code is very likel= y not doing what it appears to be doing based on the input values passed to= a function. > > > > It can easily do something valid and ignore the extra bits (pun kind of= intended), see > > mkdir("foo", 070777); > > which passes extra bits with are ignored but the application was behavi= ng in a completely deterministic and valid way. > > > > > Going through an E_WARNING would add maintainer busywork and complica= te the php-src codebase for no real gain. > > > > We've been over this before: > > If people *really* feel that the additional burden to change the code t= wice then I'd be happy to volunteer providing a small helper function/macro= to generate an E_WARNING and either (the more aggressive approach) switch = to an exception once a certain PHP version is reached or (probably the mor= e flexible way) issue a compile time warning/error informing the maintainer= to switch the warning to an Exception. > > The most simplistic version of this is a FIXME comment annotated with a= version number. Easy to grep, easy to trigger automatic alerts about once = the specified version is reached, but it can also be something more sophist= icated.. > > One way or the other could also be integrated into the CI/CD system. > > > > Our main disagreement is about the "no real gain" part as it IMHO targe= ts the long tail of PHP code / developers out there not using full-fledged = frameworks and dev environments or running legacy software on hosting servi= ces. > > > > I am very much in favor of making things easy for the code developers b= ut I am of the strong believe that it can be done in a good way for develop= ers. > > I don't see how going through an E_WARNING phase is helpful, rather I see= it as detrimental. > Foremost, what is the behaviour of introducing a warning? > Do we exit early and return false? > Or do we just warn and continue to use a possible default or nonsensical = value? > AFAIK every time a warning got introduced it followed the first approach,= so this doesn't seem to address the concern of giving developers more time= . > However, if we do continue using the prior behaviour then we haven't solv= ed the concern in the slightest. > As it may be a warning for one PHP version and in the next PHP version th= e extension supports a new flag which removes the warning for that value, l= eading back to a silent BC break if the warning wasn't addressed. > > Another technical aspect is that warnings allows userland code to run and= change the state of the VM and extension in unexpected way (we have countl= ess fuzzying reports about this) an issue that does not exist with Exceptio= ns. > > Then comes the topic about how long should it be a warning? Until the nex= t major? A single release cycle? I don't want warning promotion to become t= he same exhausting discussion that deprecation duration already is. > > I have no idea how you handle hosting, but when I used shared hosting in = the past I would never have anyone tell me that my code was producing warni= ngs or notices. > And even the one website I manage for someone which is on OVH shared host= ing I can still select a PHP version (heck even downgrading to 5.4 for some= reason). > So I'm struggling to see how for the average end user this is impacting t= hem? > And if you do just bump the PHP version for them, I'm not sure what's the= difference between having an Error immediately or producing warnings for X= years before throwing an Error and breaking > > Best regards, > > Gina P. Banyard I am in favour of exempting the validation errors from requiring RFCs, and as Gina, I do not believe that warnings are useful. I don't like that warnings even exist in the PHP language. I can see the case that you don't want to break a running application by upgrading the PHP version, but it can happen regardless. Minor PHP releases can contain minor breaking changes and each time someone upgrades PHP, they should run their test suite and verify that the application still works the same as before. Whether we introduce a Warning or ValueError, it will be caught during the upgrade process and fixed. It may even help avoid nasty bugs if the application stops on invalid input; something which could go unnoticed if it were only a warning. I am, however, concerned about one thing. If we don't require RFCs there may be situations when a contentious validation is introduced. For example, many validations can be implemented in such a way that they don't cause additional performance loss, but let's say someone decides that validating the value provides more benefit than the performance cost. Without RFC, the community cannot share their feedback, and one person's opinion wins. But if the function is used with the correct values 99.99% of the time and it's used in the hot code, the performance cost isn't worth catching the accidental invalid value.