Bug #80525 [Opn->Ver]: "Too few arguments ... exactly N expected" when using splat/scatter operator
| From: | cmb@php.net | Date: | Wed, 14 Jul 2021 12:05:36 +0000 |
| Subject: | Bug #80525 [Opn->Ver]: "Too few arguments ... exactly N expected" when using splat/scatter operator | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-235024@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=80525&edit=1
ID: 80525
Updated by: cmb@php.net
Reported by: asmqb7 at gmail dot com
Summary: "Too few arguments ... exactly N expected" when
using splat/scatter operator
-Status: Open
+Status: Verified
Type: Bug
Package: Scripting Engine problem
Operating System: Linux
PHP Version: 8.0.0
Block user comment: N
Private report: N
New Comment:
For reference: <<https://3v4l.org/N2unB>.
Previous Comments:
------------------------------------------------------------------------
[2020-12-16 10:09:50] asmqb7 at gmail dot com
Description:
------------
Just a small nitpick about PHP's error reporting that I thought I'd file for
completeness' sake.
PHP currently says "exactly N expected" instead of "at least N expected" for
functions using the ... splat/scatter operator.
[I'm not seeing an existing bug for this, based on searches for "exactly" and
"expected".]
Test script:
---------------
$ php8.0 -r 'function a($a, $b, ...$c) {} a(1);'
PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function a(), 1 passed in ...
line 1 and exactly 2 expected in ...:1
Expected result:
----------------
My suggestion:
PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function a(), 1 passed in ...
line 1 and at least 2 expected in ...:1
Actual result:
--------------
As noted
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=80525&edit=1