Skip to content

Commit 277dc35

Browse files
committed
Merge branch 'PHP-8.2'
2 parents 6556601 + e560592 commit 277dc35

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

Zend/zend_API.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2714,7 +2714,7 @@ ZEND_API zend_result zend_register_functions(zend_class_entry *scope, const zend
27142714
internal_function->prototype = NULL;
27152715
internal_function->attributes = NULL;
27162716
if (EG(active)) { // at run-time: this ought to only happen if registered with dl() or somehow temporarily at runtime
2717-
ZEND_MAP_PTR_INIT(internal_function->run_time_cache, zend_arena_alloc(&CG(arena), zend_internal_run_time_cache_reserved_size()));
2717+
ZEND_MAP_PTR_INIT(internal_function->run_time_cache, zend_arena_calloc(&CG(arena), 1, zend_internal_run_time_cache_reserved_size()));
27182718
} else {
27192719
ZEND_MAP_PTR_NEW(internal_function->run_time_cache);
27202720
}

Zend/zend_enum.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,8 +408,11 @@ static void zend_enum_register_func(zend_class_entry *ce, zend_known_string_id n
408408
zif->module = EG(current_module);
409409
zif->scope = ce;
410410
zif->T = ZEND_OBSERVER_ENABLED;
411-
ZEND_MAP_PTR_NEW(zif->run_time_cache);
412-
ZEND_MAP_PTR_SET(zif->run_time_cache, zend_arena_alloc(&CG(arena), zend_internal_run_time_cache_reserved_size()));
411+
if (EG(active)) { // at run-time
412+
ZEND_MAP_PTR_INIT(zif->run_time_cache, zend_arena_calloc(&CG(arena), 1, zend_internal_run_time_cache_reserved_size()));
413+
} else {
414+
ZEND_MAP_PTR_NEW(zif->run_time_cache);
415+
}
413416

414417
if (!zend_hash_add_ptr(&ce->function_table, name, zif)) {
415418
zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare %s::%s()", ZSTR_VAL(ce->name), ZSTR_VAL(name));

0 commit comments

Comments
 (0)