php-src/Zend/tests/gc_035.phpt
Nikita Popov 60a7e60b61 Fixed bug #72530
For objects with destructors, we will now only call the destructor
in the initial GC run, and remove any nested data. The object is
marked purple so it will be considered a root for the next GC run,
at which point it will be fully destroyed, if possible.

GC counts change on a number of tests, as the objects now get
destroyed later.
2019-08-13 14:53:53 +02:00

27 lines
372 B
PHP

--TEST--
GC 035: Lost inner-cycles garbage
--INI--
zend.enable_gc = 1
--FILE--
<?php
class A {
public $a;
public $x;
function __destruct() {
unset($this->x);
}
}
$a = new A;
$a->a = $a;
$a->x = [];
$a->x[] =& $a->x;
$a->x[] = $a;
var_dump(gc_collect_cycles());
unset($a);
var_dump(gc_collect_cycles());
var_dump(gc_collect_cycles());
--EXPECT--
int(0)
int(0)
int(2)