Bug #80525 [NEW]: "Too few arguments ... exactly N expected" when using splat/scatter operator
| From: | asmqb7 at gmail dot com | Date: | Wed, 16 Dec 2020 10:09:50 +0000 |
| Subject: | Bug #80525 [NEW]: "Too few arguments ... exactly N expected" when using splat/scatter operator | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-231117@lists.php.net to get a copy of this message | ||
From: asmqb7 at gmail dot com
Operating system: Linux
PHP version: 8.0.0
Package: Scripting Engine problem
Bug Type: Bug
Bug description:"Too few arguments ... exactly N expected" when using splat/scatter
operator
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 bug report at https://bugs.php.net/bug.php?id=80525&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=80525&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=80525&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=80525&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=80525&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=80525&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=80525&r=support
Expected behavior: https://bugs.php.net/fix.php?id=80525&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=80525&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=80525&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=80525&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80525&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=80525&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=80525&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=80525&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=80525&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=80525&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=80525&r=mysqlcfg