1
0
mirror of https://github.com/php/php-src.git synced 2026-03-26 09:12:14 +01:00

Fexed resolution of method clones

This commit is contained in:
Dmitry Stogov
2018-11-01 15:19:48 +03:00
parent aea85c65bd
commit 3a9d90f74a
2 changed files with 13 additions and 7 deletions

View File

@@ -1561,10 +1561,12 @@ int zend_optimize_script(zend_script *script, zend_long optimization_level, zend
ZEND_ASSERT(orig_op_array != NULL);
if (orig_op_array != op_array) {
uint32_t fn_flags = op_array->fn_flags;
zend_function *prototype = op_array->prototype;
HashTable *ht = op_array->static_variables;
*op_array = *orig_op_array;
op_array->fn_flags = fn_flags;
op_array->prototype = prototype;
op_array->static_variables = ht;
}

View File

@@ -3558,13 +3558,17 @@ static int preload_optimize(zend_persistent_script *script)
ZEND_HASH_FOREACH_PTR(&ce->function_table, op_array) {
if (op_array->fn_flags & ZEND_ACC_TRAIT_CLONE) {
zend_op_array *orig_op_array = zend_shared_alloc_get_xlat_entry(op_array->opcodes);
uint32_t fn_flags = op_array->fn_flags;
zend_function *prototype = op_array->prototype;
HashTable *ht = op_array->static_variables;
*op_array = *orig_op_array;
op_array->fn_flags = fn_flags;
op_array->prototype = prototype;
op_array->static_variables = ht;
if (orig_op_array) {
zend_class_entry *scope = op_array->scope;
uint32_t fn_flags = op_array->fn_flags;
zend_function *prototype = op_array->prototype;
HashTable *ht = op_array->static_variables;
*op_array = *orig_op_array;
op_array->scope = scope;
op_array->fn_flags = fn_flags;
op_array->prototype = prototype;
op_array->static_variables = ht;
}
}
} ZEND_HASH_FOREACH_END();
}