File tree Expand file tree Collapse file tree 1 file changed +60
-0
lines changed Expand file tree Collapse file tree 1 file changed +60
-0
lines changed Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ GC 045: Total count persisted when GC is rerun due to destructor call
3
+ --INI--
4
+ zend.enable_gc=1
5
+ --FILE--
6
+ <?php
7
+ class GlobalData
8
+ {
9
+ public static Bar $ bar ;
10
+ }
11
+
12
+ class Value
13
+ {
14
+ public function __destruct ()
15
+ {
16
+ new Bar ();
17
+ }
18
+ }
19
+
20
+ class Bar
21
+ {
22
+ public function __construct ()
23
+ {
24
+ GlobalData::$ bar = $ this ;
25
+ }
26
+ }
27
+
28
+ class Foo
29
+ {
30
+ public Foo $ selfRef ;
31
+ public Value $ val ;
32
+
33
+ public function __construct (Value $ val )
34
+ {
35
+ $ this ->val = $ val ;
36
+ $ this ->selfRef = $ this ;
37
+ }
38
+ }
39
+
40
+ for ($ j = 0 ; $ j < 10 ; $ j ++) {
41
+ for ($ i = 0 ; $ i < 3000 ; $ i ++) {
42
+ new Foo (new Value ());
43
+ }
44
+ }
45
+
46
+ var_dump (gc_status ());
47
+ echo 'ok ' ;
48
+ ?>
49
+ --EXPECT--
50
+ array(4) {
51
+ ["runs"]=>
52
+ int(10)
53
+ ["collected"]=>
54
+ int(25000)
55
+ ["threshold"]=>
56
+ int(10001)
57
+ ["roots"]=>
58
+ int(10000)
59
+ }
60
+ ok
You can’t perform that action at this time.
0 commit comments