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,14 +3558,18 @@ 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);
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();
}
} ZEND_HASH_FOREACH_END();