Incorrect Argument Count Error
| From: | Davey Shafik | Date: | Fri, 19 Aug 2016 13:05:19 +0000 |
| Subject: | Incorrect Argument Count Error | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-95308@lists.php.net to get a copy of this message | ||
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());
It seems that fixing this will be:
a) a mammoth task
b) a huge BC break (stuff that currently throws a warning in strict_types
mode will now throw an exception, similar BC break as we're implementing
for userland functions regardless of strict_types)
c) something we should have done for 7.0, and that we cannot change now.
We are currently heading in 7.1.0RC1 in two weeks, and I want this issue
resolved in its entirety before then.
What say you, internals?
- Davey