ru_php/Zend/tests/weakrefs/gh10043-009.phpt

29 lines
410 B
PHP

--TEST--
Self-referencing map entry GC - 009
--FILE--
<?php
class Value {
public function __construct(public readonly string $value) {
}
}
function possibleRoot($var) {
}
$map = new WeakMap();
$obj = new stdClass();
$map[$obj] = new Value('a');
$map[$map] = $map;
$ref = WeakReference::create($map);
possibleRoot($obj);
$map = null;
gc_collect_cycles();
var_dump($ref->get());
?>
--EXPECT--
NULL