php-src/Zend/tests/gc_017.phpt
Steph Fox 6d8760677d - killed off UEXPECT
- altered EXPECT for parser errors. This may or may not be a Good Thing.
2008-05-26 14:33:44 +00:00

42 lines
688 B
PHP

--TEST--
GC 017: GC and destructors with unset
--FILE--
<?php
class Node {
public $name;
public $children;
public $parent;
function __construct($name) {
$this->name = $name;
$this->children = array();
$this->parent = null;
}
function insert($node) {
$node->parent = $this;
$this->children[] = $node;
}
function __destruct() {
var_dump($this->name);
unset($this->name);
unset($this->children);
unset($this->parent);
}
}
$a = new Node('A');
$b = new Node('B');
$c = new Node('C');
$a->insert($b);
$a->insert($c);
unset($a);
unset($b);
unset($c);
var_dump(gc_collect_cycles());
echo "ok\n"
?>
--EXPECTF--
unicode(1) "%s"
unicode(1) "%s"
unicode(1) "%s"
int(10)
ok