Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93936 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 9252 invoked from network); 13 Jun 2016 13:09:28 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Jun 2016 13:09:28 -0000 Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.50 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.50 mail-wm0-f50.google.com Received: from [74.125.82.50] ([74.125.82.50:38718] helo=mail-wm0-f50.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A1/7C-12403-780BE575 for ; Mon, 13 Jun 2016 09:09:27 -0400 Received: by mail-wm0-f50.google.com with SMTP id m124so78966708wme.1 for ; Mon, 13 Jun 2016 06:09:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=MMAp7nO6xenAhjdW8uLoKBw982Ryf73GVMhk8Y8jqvs=; b=QnTHFY+E3e4Dg2jVXbdYd66qptHX9i9yIoAHFAF1+sREXweMWbcq6pmrrqPjUaNJWH MMP9812HGTcNOA5JfkgE3QuemdjB6Z0MjWYX2BwbXamIKDFLu4/8Jb//nSSkGBbvmxC+ RaxM8mNuSbZJlqq2ZLRDP2x3sa/Y5Hr6lkpcGa3PGqmHjyR2QtRmzd2qR3a9L0MXVPo6 7WrsFlcLS+L12qiEdeKIKdWFHfTLJ+9I9wrj+oCAEzvMQMOSmnSrEPlZolRSj+rVgABt bYgwi2MWMgWl2DWi95ZoHL8AelRusyH/GvzWIG1aVezcRB1PXEOXyer2UPQWb1fUHkiC +uPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=MMAp7nO6xenAhjdW8uLoKBw982Ryf73GVMhk8Y8jqvs=; b=SP7Hh/S9F2mvNzE1XDI/01uvZsZDjep0YnTkYc2lCjXTtKn+q8rkoSTHTvCGsFof4n XvpN+dnPvmNIdm1M8SKvd0p75tFQT9FsmprNrDWXW0BvQ0QvgaEcE1mrVAIjE/mZQYsP fUQ+0hjgqFFhwGlKQl48QMgCuJLLCDFiurkYtceQ6/dTNj2h3vsxBp1mlKZB/Z2R/p0x 3seaBQeLAS6nRoa01NIEAqkPsyb6z1KvcfItP0N+u7bfJljgq8vmVGI8YqK1J1uP5W/F kgB6CP6f2xBfGb1w5ugEhHBlPV8XIk+TKkvx24b9tRo+8KNl8YzJolI49Vc5WugM0JE+ FIlw== X-Gm-Message-State: ALyK8tJtA2G3MaP1XEg3G2+4a22/sM0hcGbrFX5vU2CcKRBsELTyNRz2A+kdCkRH3wducg== X-Received: by 10.194.96.177 with SMTP id dt17mr1089634wjb.90.1465823364465; Mon, 13 Jun 2016 06:09:24 -0700 (PDT) Received: from [192.168.0.98] ([93.188.182.58]) by smtp.gmail.com with ESMTPSA id zb2sm22696394wjb.46.2016.06.13.06.09.23 for (version=TLSv1/SSLv3 cipher=OTHER); Mon, 13 Jun 2016 06:09:23 -0700 (PDT) To: internals@lists.php.net References: Message-ID: <917d2186-e4c2-a2ab-b23b-624cb8973112@gmail.com> Date: Mon, 13 Jun 2016 14:07:07 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] [VOTE] Replace "Missing argument" warning with "Too few arguments" exception From: rowan.collins@gmail.com (Rowan Collins) On 06/06/2016 08:22, Dmitry Stogov wrote: > Hi, > > > This mini RFC has been moved to "Voting" state. Voting > began on Jun 6 and will close on June 16. > > You can find the full RFC at: https://wiki.php.net/rfc/too_few_args > Hi, The more I think about this RFC, the less I agree with it being included in 7.1. I realise this is now officially late in the approval process to raise these points, but note that the discussion period was just 5 days, when a language change would normally require 2 weeks. On the one hand, it doesn't stop a function's author from having to check for missing data, as claimed. As far as the receiving function is concerned, there is no difference between a missing parameter and an explicit null; both are currently allowed by default, and both are prohibited if a (non-nullable) type hint is present. Any unhinted parameter can accept nulls, so a defensive programmer must always check for them. Like strict_types mode, the change only actually affects the *caller* of the function. We can posit two types of user: those who read and fix all warnings, and those who ignore them. To a user who reads all warnings, this change makes no difference: they were already avoiding this behaviour by fixing the warnings. To a user who doesn't, it is a breaking change, which may prevent their application from running on PHP 7.1. On the other hand, there is a real risk of people delaying adoption of 7.1 because of these new errors. On the face of it, it seems like it would be trivial to fix code not to trigger this error, but there are more complex cases, such as callbacks. A simple example: function foo($a, $b, $mode) { } $callback = 'foo'; $data = [1,2]; usort($data, $callback); This code will run under all current versions of PHP, but throw an Error under 7.1 if this RFC passes. If the definition of foo(), the origin of $callback, and the usort line, are all in different places, it may not be trivial to determine the correct fix for this. There is an assumption from those who have spoken in favour of the RFC that such warnings will rarely be ignored in real world code, and therefore nobody will actually be affected by this. Here, we are pitching anecdote against anecdote; my feeling is that many people routinely ignore warnings, and will consider their code to be "running fine" under 7.0, then see it "crash" under 7.1. I was pleased when the "minor versions will retain BC" policy was adopted, because I thought it would avoid the problems we had with PHP 5.3 and 5.4, and allow wider adoption of the latest version. Allowing this change would mean that promise has been broken. Regards, -- Rowan Collins [IMSoP]