Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114230 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 20265 invoked from network); 28 Apr 2021 11:13:38 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 28 Apr 2021 11:13:38 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 78B8E1804DF for ; Wed, 28 Apr 2021 04:18:09 -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_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com [209.85.208.49]) (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:18:09 -0700 (PDT) Received: by mail-ed1-f49.google.com with SMTP id s15so73754337edd.4 for ; Wed, 28 Apr 2021 04:18:09 -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=BQOPjAi7YUGaM5BCjjvKpoW2+PquYbXkYveTY0Y698c=; b=gb07tDZdefz6uj6I9UXiey5fQdUf2kSEZsXWQlYJxpU04fsJypU4UDeIE04GinMUNF cE42Egzfq5Um9ZDd/MIOnfMJfVZPA5FfnbO5qIkoxKM+WikMWv6epgLofu1XvfJwVhyg UCO4GnB+xzf1qIeNtnT7rhSQJMC6SoyVvRm/u+Xux82G1kfg20xqN2hyakzkdzdNxzzN fT1TFAQ5KjUkmD7s7WT3fkQ6yMmNs307nl50mD6EkdHXgEbxQ8UkERceZG340qFTNTAh 46trJBqbBBVkVR/Zd6zehCaV3aJR33LHoWbZxB0ufR2qFgFFOGc9Bt2njZF/LAK4tSdN XivA== 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=BQOPjAi7YUGaM5BCjjvKpoW2+PquYbXkYveTY0Y698c=; b=PL8Tr5PSY1bQEDILYFN61124i64/WXi8AeDRiCn0cWdjDmd4RgiZROkVPkoaIpMzA5 zdhDjE2hhekIUgMjA07qov+SnFEp+m/vWSE9mk+7+HHaDfZe/sZGok4Eynnr2XhqJa1p ro4Qc2+03h3r64EY5JV0i/j/TMOG9Mm/DGiJSj8AtzsexzHUySn9Xic6IwfbZi3u3OgL Ku7D9zg8tzAqDcpLl6HlRhC5bxOeJLEHyzi4UZKax+Yf/88/V4Z7aFuIDYCNc+qaGzxp Cj0S6ESg7I2LcnWgY8ypjEQQqxBf/c+LVdytwoxBUe4QNSIUPut64v9N1E2WQbWPXQZH DHOA== X-Gm-Message-State: AOAM532Z2hQHbMbBaop0G/g4ZvAtWO61rF+vZjrNHQNfRkkLiQem6k2c lJhpJluLkGVXq1oUq+33/gUmJF48q5bBt9fYvYE= X-Google-Smtp-Source: ABdhPJxycFtoF8yZPzqcxdOifehOi484ozLdZLJHDZ66WJPPMnv4HVN0tB5nJzdENru3wn5S6/ayIobHz3i0aqql4Tw= X-Received: by 2002:aa7:d30b:: with SMTP id p11mr10341416edq.325.1619608687115; Wed, 28 Apr 2021 04:18:07 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 28 Apr 2021 12:17:56 +0100 Message-ID: To: David Gebler Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000787fb005c10688ff" Subject: Re: [PHP-DEV] PR for minor bugfix in compact() From: george.banyard@gmail.com ("G. P. B.") --000000000000787fb005c10688ff Content-Type: text/plain; charset="UTF-8" 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 --000000000000787fb005c10688ff--