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_string *function_name = op_array->function_name;
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->function_name = function_name;
op_array->scope = scope;
op_array->fn_flags = fn_flags;
op_array->prototype = prototype;
--- /dev/null
+--TEST--
+Preloading trait uses with aliased names
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.optimization_level=-1
+opcache.preload={PWD}/preload.inc
+--SKIPIF--
+<?php
+require_once('skipif.inc');
+if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
+?>
+--FILE--
+<?php
+var_dump(get_class_methods('TraitAliasTest'));
+?>
+--EXPECT--
+array(2) {
+ [0]=>
+ string(3) "bar"
+ [1]=>
+ string(3) "foo"
+}