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; 8#[AllowDynamicProperties] 9class bad { 10 public function __destruct() { 11 global $bar; 12 $bar = $this; 13 $bar->y = new stdClass; 14 } 15} 16 17$foo = new stdClass; 18$foo->foo = $foo; 19$foo->bad = new bad; 20$foo->bad->x = new stdClass; 21 22unset($foo); 23gc_collect_cycles(); 24var_dump($bar); 25?> 26--EXPECT-- 27object(bad)#2 (2) { 28 ["x"]=> 29 object(stdClass)#3 (0) { 30 } 31 ["y"]=> 32 object(stdClass)#4 (0) { 33 } 34} 35