Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127318 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 B6A4F1A00BC for ; Thu, 8 May 2025 09:28:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1746696379; bh=jbEPN+ArGXp196URN7RP/r8XGWJ3zMwlFsmpuvBB5gs=; h=From:Subject:Date:References:To:In-Reply-To:From; b=XBMMw0gjPF/y5XGFhueliu0m5N45xNbAoiH27yuA3KQ6yznZ7a7L/MJ3zy/whb4EC RZyoe16Zl8iNlyvUgZ0YQxxG6ceXyvJddZmN+6K1BOQOgSLXNVlw1WK1RkAxHqjAt+ Hwm0FnjcPcpeWaYBQDA4TCCApJ/xbSTaFeTzumabMwk/rMllYIQoueceXKxQl565B6 fjv8AW72zLZl4ARnp5Fr4UiFbwBMAb9t09WzO94BqYbfwPeYxFrf/nKTOtY/qcBVUg Y5oHKUN7iKEaKAxp3M/xj0zI93gxPeEWE/EKlyM+G3Ag2+cDHvKsbaF39F9T984mWC ccY2PlIOzMa9w== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 87CC1180074 for ; Thu, 8 May 2025 09:26:17 +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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from mail.gna.ch (mail.gna.ch [212.45.196.109]) (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 ; Thu, 8 May 2025 09:26:17 +0000 (UTC) Received: from smtpclient.apple (unknown [IPv6:2a02:1210:2e2d:4d00:71bd:dc82:54f3:f3ad]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by darkcity.gna.ch (Postfix) with ESMTPSA id 985DC3A070F for ; Thu, 08 May 2025 11:28:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=cschneid.com; s=default; t=1746696508; bh=jbEPN+ArGXp196URN7RP/r8XGWJ3zMwlFsmpuvBB5gs=; h=From:Subject:Date:References:To:In-Reply-To; b=Hmn14/4R/cDJ3IsNuBM0gFCWyYg4bQjXHePwuFwdI6dzS/C8aDJ5LArTaNPMMH3FT a9toORoZt9MZMI+Rw5PGCafc2ReEB9M+NCaezv6CIsS8nWvi0+AlW79gq5PSKaVeyP bmLdoDY49d6CAZ27JyP2xYygtsnc+edaIwr5NtjY= Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.500.181.1.5\)) Subject: Re: [PHP-DEV] [RFC] [Discussion] Minor version compatibility Date: Thu, 8 May 2025 11:28:28 +0200 References: <0433FF37-D938-4D3D-AC03-E5143218EFEA@cschneid.com> To: PHP internals In-Reply-To: Message-ID: <94CC8457-6801-4C27-87F0-11CE93EAA135@cschneid.com> X-Mailer: Apple Mail (2.3826.500.181.1.5) From: cschneid@cschneid.com (Christian Schneider) Am 08.05.2025 um 00:36 schrieb Gina P. Banyard : >> If this would have been done without warning phase then it would be a = blocker for upgrading to PHP 8.4, now filtering this warning is enough = while the packages are being updated. >=20 > Comparing a core language change to be the same level as throwing a = ValueError on invalid inputs of a bundled extension function is a bit of = a straw man argument. > The motivation for this policy change is _explicitly_ about input = validation. You are right in principle but from an application / installation = maintainers point of view it is irrelevant if an application breaks = because old code used a more relaxed language definition (as was the = case with implicitly nullable parameters) or invalid arguments (a = function might have ignored unknown flags). > I am not saying break all the things, however, breaking clearly buggy = code is something I consider a feature. But now we have the problem of defining "clearly buggy code": If the = output of some code was correct even though I gave some unknown flags to = a function which were ignored I would call that "should be fixed" but = not "clearly buggy". That's why I'm advocating of treating it in two steps instead of one. = That's all I'm saying. Now there might be cases where you feel like the parameter value is = clearly wrong but instead of having to decide that for each and every = instance (and people might disagree) I find it easier to err on the = delayed-BC-break side. > Letting users ship buggy code in production is not something that I = find at all reasonable. > And I am looking forward to your suggestion on how to simply implement = this for every single unique validation error that we encounter. Either do something like zend_warn_or_throw_exception(E_WARNING, zend_ce_value_error, = 80500, "Invalid argument ...", ...); which automatically either outputs a warning or throw an exception = depending on the PHP version or something like zend_error(E_WARNING, "Invalid argument ...", '...); /* FIXME = PHP_VERSION_ID 80500 */ which can be grepped / warned about in CI/CD whenever the PHP version is = changed and changed to a zend_throw_exception(...) at that point. This assumes that it would be possible to define a clear point where the = switch from E_WARNING to ValueError should happen but it seems doable to = me without putting a lot of burden on core developers. Regards, - Chris