xref: /PHP-7.1/Zend/tests/bug69446.phpt (revision 08c7ff0d)
1--TEST--
2Bug #69446 (GC leak relating to removal of nested data after dtors run)
3--INI--
4zend.enable_gc = 1
5--FILE--
6<?php
7$bar = NULL;
8class bad {
9	public function __destruct() {
10		global $bar;
11		$bar = $this;
12		$bar->y = new stdClass;
13	}
14}
15
16$foo = new stdClass;
17$foo->foo = $foo;
18$foo->bad = new bad;
19$foo->bad->x = new stdClass;
20
21unset($foo);
22gc_collect_cycles();
23var_dump($bar);
24--EXPECT--
25object(bad)#2 (2) {
26  ["x"]=>
27  object(stdClass)#3 (0) {
28  }
29  ["y"]=>
30  object(stdClass)#4 (0) {
31  }
32}
33