Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114291 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 81374 invoked from network); 7 May 2021 07:00:00 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 7 May 2021 07:00:00 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 1323C1801FD for ; Fri, 7 May 2021 00:06:43 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from darkcity.gna.ch (darkcity.gna.ch [195.49.47.11]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 7 May 2021 00:06:42 -0700 (PDT) Received: from smtpclient.apple (unknown [IPv6:2a02:1205:502d:fa80:70b2:5ed1:ef65:4646]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by darkcity.gna.ch (Postfix) with ESMTPSA id 3335D150E921 for ; Fri, 7 May 2021 09:06:39 +0200 (CEST) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.80.0.2.43\)) Date: Fri, 7 May 2021 09:06:38 +0200 References: To: PHP Internals In-Reply-To: Message-ID: <480BB785-0064-46D4-B705-B5E71D2DC0CC@cschneid.com> X-Mailer: Apple Mail (2.3654.80.0.2.43) Subject: Re: [PHP-DEV] PR for minor bugfix in compact() From: cschneid@cschneid.com (Christian Schneider) Am 07.05.2021 um 03:44 schrieb Ben Ramsey : > On 4/28/21 06:17, G. P. B. wrote: >> On Wed, 28 Apr 2021 at 12:12, David Gebler = wrote: >>> Hi internals, >>> I've opened a PR to cause compact() to throw a TypeError if its = parameters >>> are not valid, which I consider to be a fix for what is effectively = a bug >>> whereby logical errors in user code can be silently swallowed. >>>=20 >>> GPB has done an initial review and left a comment >>> https://github.com/php/php-src/pull/6921#pullrequestreview-646848902 = in >>> which he suggests I open this up to the floor, so here it is, = seeking >>> your feedback kindly. Also if anyone can clarify what is meant by a = warning >>> "will be promoted in PHP 9", I am not familiar with what changes are >>> planned for the next major version? >>>=20 >>> Regards >>> David >>>=20 >> Hey David, >> What I meant is that we usually don't introduce an exception without = prior >> warning to existing functionality. >> So making this a Warning in the PHP 8 series which gets promoted to a >> TypeError in PHP 9, >> similarly to how most of the internal functions went from returning = null + >> warning to throwing a TypeError, >> or many of the warnings that got promoted to ValueErrors in 8.0 = because >> it's a major release. >> Personally I don't mind introducing the TypeError immediately in PHP = 8.1, >> because compact() should be rather rare >> and mostly used on an array, but others might feel differently about = this. >> Best regards, >> George P. Banyard >=20 > Does anyone have any thoughts or concerns about this being in 8.1? I'm = trying to decide whether to merge the PR, and I'd like to make sure = anyone who wants to speak up has a chance to do so. I agree with George that it should be an E_WARNING first and then = changed to a TypeError in PHP 9. This should be the default process for reasons given in many other = threads about tightening type rules IMHO. So no, I'd prefer if this PR to be changed to E_WARNING before merging = it. - Chris