Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114231 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 21904 invoked from network); 28 Apr 2021 11:20:11 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 28 Apr 2021 11:20:11 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 353C01804BD for ; Wed, 28 Apr 2021 04:24: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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-oo1-f44.google.com (mail-oo1-f44.google.com [209.85.161.44]) (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 ; Wed, 28 Apr 2021 04:24:42 -0700 (PDT) Received: by mail-oo1-f44.google.com with SMTP id k26-20020a4adfba0000b02901f992c7ec7bso305874ook.13 for ; Wed, 28 Apr 2021 04:24:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=k5XaSR2inUIO4gUFAMS1s1rcUNhJqC/ypOIsdY7IaT4=; b=TIvJ43qi3zFy60dreV90CYGLHDxHAx67KKA06Pb9untSK9ldsCgd8TnKSvJblVj6A+ 762e6rloLICB7C2blQsngLb3G0eIXJxLsYYVCydCX5FkTZaSW9VUzAHb+rM6XkRcogNH rdXNIfkuBsyjwgQPuZDoc1wxzn2miss4N3t2y7tRB3I6e7nw8mGZAg+wQZ1M0wop7jql CP2eyy4bb6VBqKur1QkvWQQsIJldemPfDD+vynSLKUx5/A/T1VOcJ2uytrJg92Zh9zfV zfjWDHEUeth7e4qQZJxV3VQhEfmD6QmhMmWjgjhLKRKK3jhyXaoZmCQBcm/3i7+ua/5V Qfdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=k5XaSR2inUIO4gUFAMS1s1rcUNhJqC/ypOIsdY7IaT4=; b=poU12XJL6qg+OHbuflyrh1hmCAyjQ3VXe629AjUYvyp21No/PB6ltgmL+j1b57QQeb PQffhPQBNl07nL+zhqnZT5drh5xH3nfUkOnLU5gAHgmqUNExyxxCI9AKlqUlLWsc4HMH 6U2fgk1ynFW9M8KGbwEUWYZCIaxIFqfM9YTjwZGJ6ez7MpWwYucjqO3MgH2aXtbxK8WJ M1NNFQRRSftZa/Wdb4eXhXb/DXUphj6gZlDCIQjFzo5lsFbIbhPIfR52hN17Xwe5sOA3 rkwnoW9QPrsTQwGuvMYwtkE/Nmjk73WSN2xIbh/0pY5gnrF5FKaHceKXrCJrAhpbVmBw rjMw== X-Gm-Message-State: AOAM531mHvMmnhUAZ0Umm1i4uqE17MTVAdUJyW66tP3cmOcisJBaCfn7 wSZBoP/cbe2nCl38Tq1fi5Oy/J6KhzPBmpHz8OY= X-Google-Smtp-Source: ABdhPJzbQEeP+ABKM4ZSKcBoCHofkCwTerQBXgZT/XTvA+Hslk/cFBY5u+pFbxuh72c/R3IPsbjahPe96EuYMosQSwA= X-Received: by 2002:a4a:96e3:: with SMTP id t32mr22123516ooi.14.1619609080618; Wed, 28 Apr 2021 04:24:40 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 28 Apr 2021 12:24:29 +0100 Message-ID: To: "G. P. B." Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000ece12305c1069f0f" Subject: Re: [PHP-DEV] PR for minor bugfix in compact() From: davidgebler@gmail.com (David Gebler) --000000000000ece12305c1069f0f Content-Type: text/plain; charset="UTF-8" Ah I see, thanks for the clarification! I only did it this way because when I did my RFC for fsync, I recall one or two people mentioned they weren't keen on the bit where it could raise a warning rather than a TypeError - but I appreciate that one was a completely new function and not a change to an existing one (and it went through with the warning condition in the end, anyway). On Wed, 28 Apr 2021, 12:18 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. >> >> 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? >> >> Regards >> David >> > > 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 > --000000000000ece12305c1069f0f--