Skip to content

Commit 657dfc9

Browse files
committed
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3: Fix use-of-uninitialized-value in zend_get_arg_offset_by_name()
2 parents c569f51 + 6eb3fae commit 657dfc9

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Zend/zend_execute.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5264,9 +5264,9 @@ static zend_always_inline uint32_t zend_get_arg_offset_by_name(
52645264
if (EXPECTED(fbc->type == ZEND_USER_FUNCTION)
52655265
|| EXPECTED(fbc->common.fn_flags & ZEND_ACC_USER_ARG_INFO)) {
52665266
for (uint32_t i = 0; i < num_args; i++) {
5267-
zend_arg_info *arg_info = &fbc->op_array.arg_info[i];
5267+
zend_arg_info *arg_info = &fbc->common.arg_info[i];
52685268
if (zend_string_equals(arg_name, arg_info->name)) {
5269-
if (!fbc->op_array.refcount || !(fbc->op_array.fn_flags & ZEND_ACC_CLOSURE)) {
5269+
if (fbc->type == ZEND_USER_FUNCTION && (!fbc->op_array.refcount || !(fbc->op_array.fn_flags & ZEND_ACC_CLOSURE))) {
52705270
*cache_slot = unique_id;
52715271
*(uintptr_t *)(cache_slot + 1) = i;
52725272
}
@@ -5286,7 +5286,10 @@ static zend_always_inline uint32_t zend_get_arg_offset_by_name(
52865286
}
52875287

52885288
if (fbc->common.fn_flags & ZEND_ACC_VARIADIC) {
5289-
if (fbc->type == ZEND_INTERNAL_FUNCTION || !fbc->op_array.refcount || !(fbc->op_array.fn_flags & ZEND_ACC_CLOSURE)) {
5289+
if ((fbc->type == ZEND_USER_FUNCTION
5290+
&& (!fbc->op_array.refcount || !(fbc->op_array.fn_flags & ZEND_ACC_CLOSURE)))
5291+
|| (fbc->type == ZEND_INTERNAL_FUNCTION
5292+
&& !(fbc->common.fn_flags & ZEND_ACC_USER_ARG_INFO))) {
52905293
*cache_slot = unique_id;
52915294
*(uintptr_t *)(cache_slot + 1) = fbc->common.num_args;
52925295
}

0 commit comments

Comments
 (0)