Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:95312 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 26971 invoked from network); 19 Aug 2016 14:27:59 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Aug 2016 14:27:59 -0000 Authentication-Results: pb1.pair.com header.from=kalle.php@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=kalle.php@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.47 as permitted sender) X-PHP-List-Original-Sender: kalle.php@gmail.com X-Host-Fingerprint: 209.85.214.47 mail-it0-f47.google.com Received: from [209.85.214.47] ([209.85.214.47:35741] helo=mail-it0-f47.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EC/C0-17996-F6717B75 for ; Fri, 19 Aug 2016 10:27:59 -0400 Received: by mail-it0-f47.google.com with SMTP id x131so29160252ite.0 for ; Fri, 19 Aug 2016 07:27:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=PyYYIENFyroSLO4V64VSigpn2uaTaRrNz2fFnqH3Iiw=; b=suKG/DtLpUdP/i9QdLyQz49h4491bFKdxItIM9870JJnwN5UW8keAcNh+2uczmW/oa quF0PBzuQor5hPn5zZH7B0Fdwq+uxu6KUtqtMK1yffLq33/n7lpWgikYO5g8436fLkiN 52/WNmM3folTwqRlCYqtsSILMMbhos43F7ic+wUhT65ocpVIiox6ZyM+Na51mc3UOE3+ hBC3Oe1gxFi24Z1sPH8Q0tEUEL/Mca9ce63NpFPuKoghmtb1vfq9I15OHFv8eK4qK9v7 DdeYgdI16A/OWFAHrK2Wtg9Q3w2XdtoXjQ9ZcU8FG/spYjUUEz5yqJnrJmmpyECSHJBd md6w== 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=PyYYIENFyroSLO4V64VSigpn2uaTaRrNz2fFnqH3Iiw=; b=SjNm4tdaro8B7UrKa1+1dUMPrSwBOrnng7sUusrRktVDAzp2QyVnlbUkJP0lVykDHy ejbPWYItpis+5kzyzzYWp1oduvM7+MZC4OmlmOgvJFHnuK2pkIjWxulUC7u/uESNRUOA SC54Xket+RdGDZRscJpIyNv3HSdkcXhYsSdQmzDaVdhkA8TqKxNdVH0NB8grG1B/yIOZ mi/ccBp4qJk8Wkw7xMNm72VsbnzFBUrBkH5p+Bb9NL4TwKYNLfz8dYsEvoYLEm1xvATR NcH2kTh6aiK11HikInaEnRthl3A/KmGynT0w51B3jgWv7jUyjrUEwn7F+ledL6LIylgb QpOw== X-Gm-Message-State: AEkoouujpJIwuQLike6177i6Ix5hfyjswyFAgC1tW7BoyNA2e1gV+S4zqy64eJTt4s9CYlEZImdaFraHOFxjaQ== X-Received: by 10.36.190.133 with SMTP id i127mr2279268itf.1.1471616876795; Fri, 19 Aug 2016 07:27:56 -0700 (PDT) MIME-Version: 1.0 Sender: kalle.php@gmail.com Received: by 10.107.48.77 with HTTP; Fri, 19 Aug 2016 07:27:56 -0700 (PDT) In-Reply-To: References: Date: Fri, 19 Aug 2016 16:27:56 +0200 X-Google-Sender-Auth: IOq3IhXDG9zqJO_Bi6O5jq9QF8I Message-ID: To: Davey Shafik Cc: "internals@lists.php.net" , Dmitry Stogov Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] Incorrect Argument Count Error From: kalle@php.net (Kalle Sommer Nielsen) 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. -- regards, Kalle Sommer Nielsen kalle@php.net