Annotation of embedaddon/php/Zend/tests/gc_017.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: GC 017: GC and destructors with unset
        !             3: --INI--
        !             4: zend.enable_gc=1
        !             5: --FILE--
        !             6: <?php
        !             7: class Node {
        !             8:        public $name;
        !             9:        public $children;
        !            10:        public $parent;
        !            11:        function __construct($name) {
        !            12:                $this->name = $name;
        !            13:                $this->children = array();
        !            14:                $this->parent = null;
        !            15:        }
        !            16:        function insert($node) {
        !            17:                $node->parent = $this;
        !            18:                $this->children[] = $node;
        !            19:        }
        !            20:        function __destruct() {
        !            21:                var_dump($this->name);
        !            22:                unset($this->name);
        !            23:                unset($this->children);
        !            24:                unset($this->parent);
        !            25:        }
        !            26: }
        !            27: $a = new Node('A');
        !            28: $b = new Node('B');
        !            29: $c = new Node('C');
        !            30: $a->insert($b);
        !            31: $a->insert($c);
        !            32: unset($a);
        !            33: unset($b);
        !            34: unset($c);
        !            35: var_dump(gc_collect_cycles());
        !            36: echo "ok\n"
        !            37: ?>
        !            38: --EXPECTF--
        !            39: string(1) "%s"
        !            40: string(1) "%s"
        !            41: string(1) "%s"
        !            42: int(10)
        !            43: ok

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