xref: /PHP-7.1/Zend/tests/bug69446_2.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{
10	public $_private = array();
11
12	public function __construct()
13	{
14		$this->_private[] = 'php';
15	}
16
17	public function __destruct()
18	{
19		global $bar;
20		$bar = $this;
21	}
22}
23
24$foo = new stdclass;
25$foo->foo = $foo;
26$foo->bad = new bad;
27
28unserialize(serialize($foo));
29//unset($foo);
30
31gc_collect_cycles();
32var_dump($bar);
33--EXPECT--
34object(bad)#4 (1) {
35  ["_private"]=>
36  array(1) {
37    [0]=>
38    string(3) "php"
39  }
40}
41