File tree 4 files changed +43
-10
lines changed 4 files changed +43
-10
lines changed Original file line number Diff line number Diff line change 1
1
--TEST--
2
- GH-10168 (heap-buffer-overflow at zval_undefined_cv): assign typed prop
2
+ GH-10168 (heap-buffer-overflow at zval_undefined_cv): assign typed static prop
3
3
--FILE--
4
4
<?php
5
5
class Test
Original file line number Diff line number Diff line change @@ -11,16 +11,9 @@ $box = new Box();
11
11
12
12
class Test
13
13
{
14
- static ?Test $ a = null ;
15
-
16
14
public function __construct () {
17
15
global $ box ;
18
-
19
- if (self ::$ a === null ) {
20
- var_dump ($ box ->storage = $ this );
21
- } else {
22
- var_dump ($ box ->storage = $ this );
23
- }
16
+ var_dump ($ box ->storage = $ this );
24
17
}
25
18
26
19
function __destruct () {
Original file line number Diff line number Diff line change 1
1
--TEST--
2
- GH-10168 (heap-buffer-overflow at zval_undefined_cv): assign typed prop
2
+ GH-10168 (heap-buffer-overflow at zval_undefined_cv): allocated assignment in destructor
3
3
--FILE--
4
4
<?php
5
5
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ GH-10168 (heap-buffer-overflow at zval_undefined_cv): assign typed prop without cache slot
3
+ --XFAIL--
4
+ --FILE--
5
+ <?php
6
+
7
+ class Box {
8
+ public $ storage ;
9
+ }
10
+
11
+ $ box = new Box ();
12
+
13
+ class Test
14
+ {
15
+ public function __construct () {
16
+ static $ i = 0 ;
17
+ $ i ++;
18
+ global $ box ;
19
+ if ($ i === 1 ) {
20
+ var_dump ($ box ->storage = $ this );
21
+ } else {
22
+ // Avoid cache slot, triggering write_property
23
+ var_dump ($ box ->storage = $ this );
24
+ }
25
+ }
26
+
27
+ function __destruct () {
28
+ global $ box ;
29
+ $ box ->storage = null ;
30
+ }
31
+ }
32
+ new Test ();
33
+ new Test ();
34
+
35
+ ?>
36
+ --EXPECT--
37
+ object(Test)#2 (0) {
38
+ }
39
+ object(Test)#3 (0) {
40
+ }
You can’t perform that action at this time.
0 commit comments