php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80525 "Too few arguments ... exactly N expected" when using splat/scatter operator
Submitted: 2020-12-16 10:09 UTC Modified: 2021-07-14 12:05 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: asmqb7 at gmail dot com Assigned:
Status: Verified Package: Scripting Engine problem
PHP Version: 8.0.0 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
32 - 12 = ?
Subscribe to this entry?

 
 [2020-12-16 10:09 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-07-14 12:05 UTC] cmb@php.net
-Status: Open +Status: Verified
 [2021-07-14 12:05 UTC] cmb@php.net
For reference: <<https://3v4l.org/N2unB>.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 04:01:30 2024 UTC