summaryrefslogtreecommitdiff
path: root/Zend/zend_execute.c
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-07-31 12:00:56 +0200
committerNikita Popov <nikita.ppv@gmail.com>2020-07-31 12:02:28 +0200
commita6e63b42c3ba1e45fc4c2e2154ca34e844f323b1 (patch)
treeba023709d5bc29019d3c2c43d5a156e5b86430f7 /Zend/zend_execute.c
parentb3e12325f687e335bfc283b6072e311e72ed9f43 (diff)
downloadphp-git-a6e63b42c3ba1e45fc4c2e2154ca34e844f323b1.tar.gz
Make check in RECV_VARIADIC more precise
Fetch arg_info only once (it's always the same one...) and check ZEND_TYPE_IS_SET on it, rather than checking if *any* parameter has a type.
Diffstat (limited to 'Zend/zend_execute.c')
-rw-r--r--Zend/zend_execute.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index 51d4a0d003..d6809cb670 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -1051,17 +1051,12 @@ static zend_always_inline int zend_verify_recv_arg_type(zend_function *zf, uint3
return 1;
}
-static zend_always_inline int zend_verify_variadic_arg_type(zend_function *zf, uint32_t arg_num, zval *arg, void **cache_slot)
+static zend_always_inline int zend_verify_variadic_arg_type(
+ zend_function *zf, zend_arg_info *arg_info, uint32_t arg_num, zval *arg, void **cache_slot)
{
- zend_arg_info *cur_arg_info;
-
- ZEND_ASSERT(arg_num > zf->common.num_args);
- ZEND_ASSERT(zf->common.fn_flags & ZEND_ACC_VARIADIC);
- cur_arg_info = &zf->common.arg_info[zf->common.num_args];
-
- 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);
+ ZEND_ASSERT(ZEND_TYPE_IS_SET(arg_info->type));
+ if (UNEXPECTED(!zend_check_type(arg_info->type, arg, cache_slot, zf->common.scope, 0, 0))) {
+ zend_verify_arg_error(zf, arg_info, arg_num, cache_slot, arg);
return 0;
}