File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4379,13 +4379,15 @@ static void preload_fix_trait_op_array(zend_op_array *op_array)
43794379 uint32_t fn_flags2 = op_array -> fn_flags2 ;
43804380 zend_function * prototype = op_array -> prototype ;
43814381 HashTable * ht = op_array -> static_variables ;
4382+ const zend_property_info * prop_info = op_array -> prop_info ;
43824383 * op_array = * orig_op_array ;
43834384 op_array -> function_name = function_name ;
43844385 op_array -> scope = scope ;
43854386 op_array -> fn_flags = fn_flags ;
43864387 op_array -> fn_flags2 = fn_flags2 ;
43874388 op_array -> prototype = prototype ;
43884389 op_array -> static_variables = ht ;
4390+ op_array -> prop_info = prop_info ;
43894391}
43904392
43914393static void preload_fix_trait_methods (const zend_class_entry * ce )
Original file line number Diff line number Diff line change 1+ --TEST--
2+ GH-21770 (Infinite recursion in property hook getter in opcache preloaded trait)
3+ --INI--
4+ opcache.enable=1
5+ opcache.enable_cli=1
6+ opcache.optimization_level=-1
7+ opcache.preload={PWD}/preload_gh21770.inc
8+ --EXTENSIONS--
9+ opcache
10+ --SKIPIF--
11+ <?php
12+ if (PHP_OS_FAMILY == 'Windows ' ) die ('skip Preloading is not supported on Windows ' );
13+ ?>
14+ --FILE--
15+ <?php
16+ $ b = new B ();
17+ echo $ b ->a , "\n" ;
18+
19+ $ c = new C ();
20+ $ c ->x = 42 ;
21+ var_dump ($ c ->x );
22+ ?>
23+ --EXPECT--
24+ a
25+ int(42)
Original file line number Diff line number Diff line change 1+ <?php
2+ trait A {
3+ public ?string $ a = 'a ' {
4+ get => $ this ->a ;
5+ }
6+ }
7+
8+ trait X {
9+ public int $ x = 0 {
10+ set(int $ value ) => $ value ;
11+ }
12+ }
13+
14+ class B {
15+ use A;
16+ }
17+
18+ class C {
19+ use X;
20+ }
You can’t perform that action at this time.
0 commit comments