mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Check type is set when verifying variadic args
Weird that there was no test for this... This code is somewhat inefficient, because it will be performed for every arg, rather than only once.
This commit is contained in:
parent
296269cfe8
commit
bd7b1afd6e
2 changed files with 4 additions and 1 deletions
|
@ -20,8 +20,10 @@ class Test implements TestInterface {
|
|||
$obj = new Test;
|
||||
$obj->foo();
|
||||
$obj->bar([]);
|
||||
$obj->bar([], 1);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Test::foo
|
||||
Test::bar
|
||||
Test::bar
|
||||
|
|
|
@ -1042,7 +1042,8 @@ static zend_always_inline int zend_verify_variadic_arg_type(zend_function *zf, u
|
|||
ZEND_ASSERT(zf->common.fn_flags & ZEND_ACC_VARIADIC);
|
||||
cur_arg_info = &zf->common.arg_info[zf->common.num_args];
|
||||
|
||||
if (UNEXPECTED(!zend_check_type(cur_arg_info->type, arg, cache_slot, zf->common.scope, 0, 0))) {
|
||||
if (ZEND_TYPE_IS_SET(cur_arg_info->type)
|
||||
&& UNEXPECTED(!zend_check_type(cur_arg_info->type, arg, cache_slot, zf->common.scope, 0, 0))) {
|
||||
zend_verify_arg_error(zf, cur_arg_info, arg_num, cache_slot, arg);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue