Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:95363 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 60176 invoked from network); 22 Aug 2016 08:18:38 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Aug 2016 08:18:38 -0000 Authentication-Results: pb1.pair.com smtp.mail=me@daveyshafik.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=me@daveyshafik.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain daveyshafik.com from 209.85.218.42 cause and error) X-PHP-List-Original-Sender: me@daveyshafik.com X-Host-Fingerprint: 209.85.218.42 mail-oi0-f42.google.com Received: from [209.85.218.42] ([209.85.218.42:34869] helo=mail-oi0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E2/42-35246-C55BAB75 for ; Mon, 22 Aug 2016 04:18:37 -0400 Received: by mail-oi0-f42.google.com with SMTP id 4so141103826oih.2 for ; Mon, 22 Aug 2016 01:18:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daveyshafik-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=ab4fB6DYqHJceiOtYHMgFFN7Q63B74ccNP2popR9AV8=; b=oFzDrqJyPxQXYlpPZJxgQcXwYgif3IAIfI1I8TL0jcFHgE1m/EXmA+NOF0V8cw8o8h CaD3JUC4Lq9ueUNEXm06Hru5+4yYHTz8JSV05LKEkMdKjgcyqqRTGRQedaFuM9zHENwL JNuVKIbspodF5tbSVrVuukfoyYiqeNgQMseFEPnAMFMZbxjRAXUz8ifoOwvHhgaPuhh5 corIValWqjKw1Ht/WEsmot2K9pOavqWM638bsYF+Y/cLqmCUW7i+xjpsRc0cbqvVbNck RQJNAQdju9BiQWaR+NWNV6pmve4zHQQBVRx3rqwrInXvhYIKexnmAV/5kG2rtn5xxrqQ 6TIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=ab4fB6DYqHJceiOtYHMgFFN7Q63B74ccNP2popR9AV8=; b=dA+mJ1PkufUqZq7RNDkvAqN9AymQtKdj62wRyjf+158QD7IWBRedR+310TI0bqdlFO GXo37QypW3x+M2nlnA+BK24cdQaa4np8HKR+tQWHUQz3IjAJ5SH63HOAtkmrUa0CQtFZ j/KvBz0/jtMXVxwc/RS7njWtQ5TxX1ivHrTBJismpHdc+iHxrbhL7mWuyiBJTj86/VIU Yf3/DizSQlqAfMq7rnTpbY7wgs3kKIySnsHzjIObW3Qj/ZEhXJOlWc/mlvzP4Yn/ZSvR L6XRAxfa7/O24Grhleix/UOdmlsfLugAXI3P4ZXP/h9JNnYYtXHScJ/15XgLaNkb4QVJ CwyA== X-Gm-Message-State: AEkoouvkdTm8yfF0bN8ispY2XTw5PJHJp7lMBW0DP6TJpuJcVyqWD0crBDUklqzXxuvqwZs40KIz/mVNDhvnGEmQ X-Received: by 10.202.193.136 with SMTP id r130mr10641921oif.32.1471853913739; Mon, 22 Aug 2016 01:18:33 -0700 (PDT) MIME-Version: 1.0 Sender: me@daveyshafik.com Received: by 10.182.40.136 with HTTP; Mon, 22 Aug 2016 01:18:33 -0700 (PDT) In-Reply-To: References: Date: Mon, 22 Aug 2016 16:18:33 +0800 X-Google-Sender-Auth: Kt0Sc3CmtWkJ26hncDzRbTodmzE Message-ID: To: Kalle Sommer Nielsen Cc: "internals@lists.php.net" , Dmitry Stogov Content-Type: multipart/alternative; boundary=001a113dc22ab0ad5a053aa4b18e Subject: Re: [PHP-DEV] Incorrect Argument Count Error From: davey@php.net (Davey Shafik) --001a113dc22ab0ad5a053aa4b18e Content-Type: text/plain; charset=UTF-8 On Fri, Aug 19, 2016 at 10:27 PM, Kalle Sommer Nielsen wrote: > 2016-08-19 15:05 GMT+02:00 Davey Shafik : > > Hey Internals, > > > > I'm working on the patch to change the error exception to > > \ArgumentCountError instead of \Error when too few, or too many arguments > > are passed in as discussed a couple of weeks ago. > > > > To be BC with 7.0, this extends \TypeError, which is the exception > > currently thrown when strict_types=1 for both userland and internal > > functions. > > > > I've run into an issue where things are inconsistent for internal > functions. > > > > For example, the array_* functions, like array_diff, still have a warning > > thrown, regardless of strict_types: > > > > php_error_docref(NULL, E_WARNING, "at least %d parameters are required, > %d > > given", req_args, ZEND_NUM_ARGS()); > > This seems more like an oversight than anything else, I guess cases > with variable argument count may have some similar parameter parsing > approaches. I think it should just be changed to the exception and to > respect strict_types. Despite it being a BC break, I don't think that > many will care to notice since its error handling for one and second > of all, we did do that for a lot of things in 7.0, and I would assume > that most of the userland developers expect us to continue converting > into exceptions where reasonable, so the programs will *hopefully* > quickly adapt. I have completed this as best as I can tell. All test failures also exist on master without the patch. https://github.com/php/php-src/pull/2092 The only potential issue is that the format of the warning message has changed slightly from e.g.: -Warning: array_diff(): at least 2 parameters are required, 0 given in %s on line %d +Warning: array_diff() expects at least 2 parameters, 0 given in %s on line %d I suspect there are other functions that are not array functions that emit similar warnings (especially for functions that expect _exact_ number of arguments) that I missed, so if you know any of these, please let me know and I'll update the patch. If everyone is good with this I will merge down to PHP 7.1 for RC1 next week. - Davey --001a113dc22ab0ad5a053aa4b18e--