1
0
mirror of https://github.com/php/php-src.git synced 2026-04-30 03:33:17 +02:00
Files
archived-php-src/Zend/tests/gc_017.phpt
T
Dmitry Stogov a186ac0e47 IS_CONST operands don't have to be separated. Use reference-counting instead of duplication.
- with opcache all IS_CONST operands are not refcounted (scalars, interned strings or immutable arrays)
- without opcache IS_CONST operands are not shared between processes or threads and may use common reference counters
2016-04-05 20:09:14 +03:00

43 lines
681 B
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->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