xref: /PHP-8.1/Zend/tests/bug70805_2.phpt (revision 7aacc705)
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}
9
10class B {
11}
12
13class C {
14    public function __destruct() {
15        if (isset($GLOBALS["a"])) {
16            unset($GLOBALS["a"]);
17        }
18    }
19}
20
21$a = new A;
22$a->b = new B;
23$a->b->a = $a;
24
25$i = 0;
26
27while ($i++ < 9999) {
28    $t = [];
29    $t[] = &$t;
30    unset($t);
31}
32$t = [new C];
33$t[] = &$t;
34unset($t);
35
36unset($a);
37var_dump(gc_collect_cycles());
38?>
39--EXPECT--
40int(2)
41