xref: /PHP-8.2/Zend/tests/bug70805_2.phpt (revision 902d6439)
1--TEST--
2Bug #70805 (Segmentation faults whilst running Drupal 8 test suite) (Memleak)
3--INI--
4zend.enable_gc = 1
5--FILE--
6<?php
7class A {
8    public $b;
9}
10
11class B {
12    public $a;
13}
14
15class C {
16    public function __destruct() {
17        if (isset($GLOBALS["a"])) {
18            unset($GLOBALS["a"]);
19        }
20    }
21}
22
23$a = new A;
24$a->b = new B;
25$a->b->a = $a;
26
27$i = 0;
28
29while ($i++ < 9999) {
30    $t = [];
31    $t[] = &$t;
32    unset($t);
33}
34$t = [new C];
35$t[] = &$t;
36unset($t);
37
38unset($a);
39var_dump(gc_collect_cycles());
40?>
41--EXPECT--
42int(2)
43