xref: /PHP-8.1/Zend/tests/bug69446_2.phpt (revision 7aacc705)
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?>
34--EXPECT--
35object(bad)#4 (1) {
36  ["_private"]=>
37  array(1) {
38    [0]=>
39    string(3) "php"
40  }
41}
42