Skip to content

Commit 72b3c89

Browse files
committed
Zend: Use EX(func) and avoid tmp zval copy in zend_enum_values_func()
1 parent b4d9250 commit 72b3c89

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

Zend/zend_enum.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ static ZEND_NAMED_FUNCTION(zend_enum_try_from_func)
415415

416416
static ZEND_NAMED_FUNCTION(zend_enum_values_func)
417417
{
418-
zend_class_entry *ce = execute_data->func->common.scope;
418+
zend_class_entry *ce = EX(func)->common.scope;
419419
zend_class_constant *c;
420420

421421
ZEND_PARSE_PARAMETERS_NONE();
@@ -433,9 +433,8 @@ static ZEND_NAMED_FUNCTION(zend_enum_values_func)
433433
}
434434
}
435435
zval *prop = zend_enum_fetch_case_value(Z_OBJ_P(zv));
436-
zval tmp;
437-
ZVAL_COPY(&tmp, prop);
438-
zend_hash_next_index_insert_new(Z_ARRVAL_P(return_value), &tmp);
436+
Z_TRY_ADDREF_P(prop);
437+
zend_hash_next_index_insert_new(Z_ARRVAL_P(return_value), prop);
439438
} ZEND_HASH_FOREACH_END();
440439
}
441440
static void zend_enum_register_func(zend_class_entry *ce, zend_known_string_id name_id, zend_internal_function *zif) {

0 commit comments

Comments
 (0)