File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / Zend / tests / gc_017.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:47:52 2012 UTC (12 years, 4 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

--TEST--
GC 017: GC and destructors with unset
--INI--
zend.enable_gc=1
--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--
string(1) "%s"
string(1) "%s"
string(1) "%s"
int(10)
ok

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>