2016-08-19 15:05 GMT+02:00 Davey Shafik <da...@php.net>:
> 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());

This seems more like an oversight than anything else, I guess cases
with variable argument count may have some similar parameter parsing
approaches. I think it should just be changed to the exception and to
respect strict_types. Despite it being a BC break, I don't think that
many will care to notice since its error handling for one and second
of all, we did do that for a lot of things in 7.0, and I would assume
that most of the userland developers expect us to continue converting
into exceptions where reasonable, so the programs will *hopefully*
quickly adapt.


-- 
regards,

Kalle Sommer Nielsen
ka...@php.net

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to