php-src/Zend/tests/gc_041.phpt
2020-02-03 22:52:20 +01:00

37 lines
583 B
PHP

--TEST--
GC 041: Handling of references in nested data of objects with destructor
--INI--
zend.enable_gc = 1
--FILE--
<?php
class ryat {
var $ryat;
var $chtg;
var $nested;
function __destruct() {
$GLOBALS['x'] = $this;
}
}
$o = new ryat;
$o->nested = [];
$o->nested[] =& $o->nested;
$o->ryat = $o;
$x =& $o->chtg;
unset($o);
var_dump(gc_collect_cycles());
var_dump($x);
?>
--EXPECT--
int(0)
object(ryat)#1 (3) {
["ryat"]=>
*RECURSION*
["chtg"]=>
*RECURSION*
["nested"]=>
&array(1) {
[0]=>
*RECURSION*
}
}