mirror of
https://github.com/php/php-src.git
synced 2024-11-23 18:04:36 +08:00
Call function_add_ref() in proper place
This commit is contained in:
parent
e5edaed69b
commit
2fefa8c61e
@ -1301,7 +1301,6 @@ static void zend_add_trait_method(zend_class_entry *ce, const char *name, zend_s
|
||||
}
|
||||
}
|
||||
|
||||
function_add_ref(fn);
|
||||
if (UNEXPECTED(fn->type == ZEND_INTERNAL_FUNCTION)) {
|
||||
new_fn = zend_arena_alloc(&CG(arena), sizeof(zend_internal_function));
|
||||
memcpy(new_fn, fn, sizeof(zend_internal_function));
|
||||
@ -1310,10 +1309,8 @@ static void zend_add_trait_method(zend_class_entry *ce, const char *name, zend_s
|
||||
new_fn = zend_arena_alloc(&CG(arena), sizeof(zend_op_array));
|
||||
memcpy(new_fn, fn, sizeof(zend_op_array));
|
||||
new_fn->op_array.fn_flags &= ~ZEND_ACC_IMMUTABLE;
|
||||
ZEND_MAP_PTR_INIT(new_fn->op_array.run_time_cache, zend_arena_alloc(&CG(arena), sizeof(void*)));
|
||||
ZEND_MAP_PTR_SET(new_fn->op_array.run_time_cache, NULL);
|
||||
ZEND_MAP_PTR_INIT(new_fn->op_array.static_variables_ptr, &new_fn->op_array.static_variables);
|
||||
}
|
||||
function_add_ref(new_fn);
|
||||
fn = zend_hash_update_ptr(&ce->function_table, key, new_fn);
|
||||
zend_add_magic_methods(ce, key, fn);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user