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