xref: /PHP-8.4/Zend/tests/bug70805_1.phpt (revision 902d6439)
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    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["array"]);
19            unset($GLOBALS["a"]);
20        }
21    }
22}
23
24$a = new A;
25$a->b = new B;
26$a->b->a = $a;
27
28$i = 0;
29
30$c = new A;
31$array = array($c);
32unset($c);
33
34while ($i++ < 9998) {
35    $t = [];
36    $t[] = &$t;
37    unset($t);
38}
39$t = [new C];
40$t[] = &$t;
41unset($t);
42unset($a);
43
44var_dump(gc_collect_cycles());
45?>
46--EXPECT--
47int(2)
48