File tree 3 files changed +69
-1
lines changed
3 files changed +69
-1
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,8 @@ PHP NEWS
42
42
43
43
- Opcache:
44
44
. Fixed opcache_invalidate() on deleted file. (mikhainin)
45
+ . Fixed bug GH-12380 (JIT+private array property access inside closure
46
+ accesses private property in child class). (nielsdos)
45
47
46
48
- PCRE:
47
49
. Fixed bug GH-11956 (Backport upstream fix, PCRE regular expressions with
Original file line number Diff line number Diff line change @@ -650,7 +650,11 @@ static zend_property_info* zend_get_known_property_info(const zend_op_array *op_
650
650
return info ;
651
651
} else if (on_this ) {
652
652
if (ce == info -> ce ) {
653
- return info ;
653
+ if (ce == op_array -> scope ) {
654
+ return info ;
655
+ } else {
656
+ return NULL ;
657
+ }
654
658
} else if ((info -> flags & ZEND_ACC_PROTECTED )
655
659
&& instanceof_function_slow (ce , info -> ce )) {
656
660
return info ;
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ GH-12380: JIT+private array property access inside closure accesses private property in child class
3
+ --INI--
4
+ opcache.enable=1
5
+ opcache.enable_cli=1
6
+ opcache.file_update_protection=0
7
+ opcache.jit_buffer_size=1M
8
+ opcache.protect_memory=1
9
+ opcache.jit=tracing
10
+ opcache.jit_hot_loop=1
11
+ opcache.jit_hot_func=1
12
+ opcache.jit_hot_return=1
13
+ opcache.jit_hot_side_exit=1
14
+ --EXTENSIONS--
15
+ opcache
16
+ --FILE--
17
+ <?php
18
+
19
+ abstract class a
20
+ {
21
+ private int $ v = 1 ;
22
+
23
+ public function test (): void
24
+ {
25
+ var_dump ($ this ->v );
26
+ (function (): void {
27
+ var_dump ($ this ->v );
28
+ })();
29
+ }
30
+ }
31
+
32
+ final class b extends a {
33
+ private int $ v = 0 ;
34
+ }
35
+ $ a = new b ;
36
+
37
+ for ($ i = 0 ; $ i < 10 ; $ i ++) {
38
+ $ a ->test ();
39
+ }
40
+
41
+ ?>
42
+ --EXPECT--
43
+ int(1)
44
+ int(1)
45
+ int(1)
46
+ int(1)
47
+ int(1)
48
+ int(1)
49
+ int(1)
50
+ int(1)
51
+ int(1)
52
+ int(1)
53
+ int(1)
54
+ int(1)
55
+ int(1)
56
+ int(1)
57
+ int(1)
58
+ int(1)
59
+ int(1)
60
+ int(1)
61
+ int(1)
62
+ int(1)
You can’t perform that action at this time.
0 commit comments