2015-04-15 00:53:56 +08:00
|
|
|
--TEST--
|
|
|
|
Bug #69446 (GC leak relating to removal of nested data after dtors run)
|
2017-01-11 01:17:31 +08:00
|
|
|
--INI--
|
|
|
|
zend.enable_gc = 1
|
2015-04-15 00:53:56 +08:00
|
|
|
--FILE--
|
|
|
|
<?php
|
|
|
|
$bar = NULL;
|
2021-10-11 21:49:27 +08:00
|
|
|
#[AllowDynamicProperties]
|
2015-04-15 00:53:56 +08:00
|
|
|
class bad {
|
2020-02-04 05:52:20 +08:00
|
|
|
public function __destruct() {
|
|
|
|
global $bar;
|
|
|
|
$bar = $this;
|
|
|
|
$bar->y = new stdClass;
|
|
|
|
}
|
2015-04-15 00:53:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
$foo = new stdClass;
|
|
|
|
$foo->foo = $foo;
|
|
|
|
$foo->bad = new bad;
|
|
|
|
$foo->bad->x = new stdClass;
|
|
|
|
|
|
|
|
unset($foo);
|
|
|
|
gc_collect_cycles();
|
|
|
|
var_dump($bar);
|
2020-08-09 17:06:57 +08:00
|
|
|
?>
|
2015-04-15 00:53:56 +08:00
|
|
|
--EXPECT--
|
|
|
|
object(bad)#2 (2) {
|
|
|
|
["x"]=>
|
|
|
|
object(stdClass)#3 (0) {
|
|
|
|
}
|
|
|
|
["y"]=>
|
|
|
|
object(stdClass)#4 (0) {
|
|
|
|
}
|
|
|
|
}
|