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