summaryrefslogtreecommitdiff
path: root/Zend/tests/bug69446.phpt
blob: 66595c170cb381d9029d3014a33129f8a91d0edd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
--TEST--
Bug #69446 (GC leak relating to removal of nested data after dtors run)
--INI--
zend.enable_gc = 1
--FILE--
<?php
$bar = NULL;
class bad {
	public function __destruct() {
		global $bar;
		$bar = $this;
		$bar->y = new stdClass;
	}
}

$foo = new stdClass;
$foo->foo = $foo;
$foo->bad = new bad;
$foo->bad->x = new stdClass;

unset($foo);
gc_collect_cycles();
var_dump($bar);
--EXPECT--
object(bad)#2 (2) {
  ["x"]=>
  object(stdClass)#3 (0) {
  }
  ["y"]=>
  object(stdClass)#4 (0) {
  }
}