File tree Expand file tree Collapse file tree 3 files changed +31
-0
lines changed Expand file tree Collapse file tree 3 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -4147,11 +4147,13 @@ static void preload_fix_trait_methods(zend_class_entry *ce)
4147
4147
if (op_array -> fn_flags & ZEND_ACC_TRAIT_CLONE ) {
4148
4148
zend_op_array * orig_op_array = zend_shared_alloc_get_xlat_entry (op_array -> opcodes );
4149
4149
if (orig_op_array ) {
4150
+ zend_string * function_name = op_array -> function_name ;
4150
4151
zend_class_entry * scope = op_array -> scope ;
4151
4152
uint32_t fn_flags = op_array -> fn_flags ;
4152
4153
zend_function * prototype = op_array -> prototype ;
4153
4154
HashTable * ht = op_array -> static_variables ;
4154
4155
* op_array = * orig_op_array ;
4156
+ op_array -> function_name = function_name ;
4155
4157
op_array -> scope = scope ;
4156
4158
op_array -> fn_flags = fn_flags ;
4157
4159
op_array -> prototype = prototype ;
Original file line number Diff line number Diff line change @@ -45,6 +45,12 @@ class Z {
45
45
46
46
class Z2 extends Z {}
47
47
48
+ class TraitAliasTest {
49
+ use T1 {
50
+ T1 ::foo as bar;
51
+ }
52
+ }
53
+
48
54
function get_anon () {
49
55
return new class {};
50
56
}
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Preloading trait uses with aliased names
3
+ --INI--
4
+ opcache.enable=1
5
+ opcache.enable_cli=1
6
+ opcache.optimization_level=-1
7
+ opcache.preload={PWD}/preload.inc
8
+ --SKIPIF--
9
+ <?php
10
+ require_once ('skipif.inc ' );
11
+ if (PHP_OS_FAMILY == 'Windows ' ) die ('skip Preloading is not supported on Windows ' );
12
+ ?>
13
+ --FILE--
14
+ <?php
15
+ var_dump (get_class_methods ('TraitAliasTest ' ));
16
+ ?>
17
+ --EXPECT--
18
+ array(2) {
19
+ [0]=>
20
+ string(3) "bar"
21
+ [1]=>
22
+ string(3) "foo"
23
+ }
You can’t perform that action at this time.
0 commit comments