Req #81595 [NEW]: Arguments count should be checked prior individual argument type
| From: | michael dot vorisek at email dot cz | Date: | Sat, 06 Nov 2021 14:15:06 +0000 |
| Subject: | Req #81595 [NEW]: Arguments count should be checked prior individual argument type | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-237579@lists.php.net to get a copy of this message | ||
From: michael dot vorisek at email dot cz
Operating system: any
PHP version: 7.4.25
Package: *General Issues
Bug Type: Feature/Change Request
Bug description:Arguments count should be checked prior individual argument type
Description:
------------
If arguments count does not match, it should be reported instead of
trying to check the arguments type first.
https://3v4l.org/X53qH
Test script:
---------------
function test(int $a, string $b) {
}
try {
test(1);
} catch (Error $e) { echo $e->getMessage() . "\n"; }
try {
test('test');
} catch (Error $e) { echo $e->getMessage() . "\n"; }
Expected result:
----------------
Too few arguments to function test(), 1 passed in /in/X53qH on line 7
and exactly 2 expected
Too few arguments to function test(), 1 passed in /in/X53qH on line 7
and exactly 2 expected
Actual result:
--------------
Too few arguments to function test(), 1 passed in /in/X53qH on line 7
and exactly 2 expected
test(): Argument #1 ($a) must be of type int, string given, called in
/in/X53qH on line 11
--
Edit bug report at https://bugs.php.net/bug.php?id=81595&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=81595&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=81595&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=81595&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=81595&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=81595&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=81595&r=support
Expected behavior: https://bugs.php.net/fix.php?id=81595&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=81595&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=81595&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=81595&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=81595&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=81595&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=81595&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=81595&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=81595&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=81595&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=81595&r=mysqlcfg