Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:102016 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 54075 invoked from network); 4 Apr 2018 07:32:50 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Apr 2018 07:32:50 -0000 Authentication-Results: pb1.pair.com header.from=ivan.enderlin@hoa-project.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=ivan.enderlin@hoa-project.net; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain hoa-project.net from 217.70.183.199 cause and error) X-PHP-List-Original-Sender: ivan.enderlin@hoa-project.net X-Host-Fingerprint: 217.70.183.199 relay9-d.mail.gandi.net Received: from [217.70.183.199] ([217.70.183.199:41893] helo=relay9-d.mail.gandi.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1F/47-16040-E9F74CA5 for ; Wed, 04 Apr 2018 03:32:48 -0400 X-Originating-IP: 178.211.245.124 Received: from hwhost.local (unknown [178.211.245.124]) (Authenticated sender: ivan.enderlin@hoa-project.net) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id EDB3CFF812 for ; Wed, 4 Apr 2018 09:32:44 +0200 (CEST) To: internals@lists.php.net References: Message-ID: Date: Wed, 4 Apr 2018 09:32:43 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Subject: Re: [PHP-DEV] [RFC][Discussion] Make compact function reports undefined passed variables From: ivan.enderlin@hoa-project.net (Ivan Enderlin) Hello, Yes, a thousand yes. Silently ignoring undefined variables is a source of multiple bugs. Emiting a warning is a small BC break comparing to the benefits. Regards. On 02.04.18 11:17, Gabriel Caruso wrote: > Hello dear internals, how are you? > > I'd like to propose a new RFC to PHP's core, but as this one contains a BC > Break, let's discussed it before making anything official. > > A couple of days ago, while discussing some [Coding Standards rules for > Doctrine, forbidden the `compact` function]( > https://github.com/doctrine/coding-standard/pull/49), an argument caught my > attention: > >> The `compact` function var does not report undefined variables. > Looking in [the `compact` documentation](https://secure.php.net/compact), > this is even emphasizes: > >> Any strings that are not set will simply be skipped. > I couldn't figure out why this is done this way, but, here's what I'd like > to propose: make the `compact` function starts to report undefined passed > variables for it. > > With [only 2 lines of code]( > https://github.com/php/php-src/compare/master...carusogabriel:warning-unknow-compact-variable), > this is possible, but, of course, this is a BC Break. > > Let me know your opinion on that, and perhaps, make it happen! > > Regards,