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