1--TEST--
2Self-referencing map entry GC - 009
3--FILE--
4<?php
5
6class Value {
7    public function __construct(public readonly string $value) {
8    }
9}
10
11function possibleRoot($var) {
12}
13
14$map = new WeakMap();
15$obj = new stdClass();
16$map[$obj] = new Value('a');
17$map[$map] = $map;
18$ref = WeakReference::create($map);
19
20possibleRoot($obj);
21$map = null;
22
23gc_collect_cycles();
24
25var_dump($ref->get());
26?>
27--EXPECT--
28NULL
29