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