1--TEST--
2Self-referencing map entry GC - 014
3--FILE--
4<?php
5
6class Value {
7    public function __construct(public readonly string $value) {
8    }
9}
10
11$map = new WeakMap();
12$obj = new Value('a');
13$map[$obj] = $obj;
14
15gc_collect_cycles();
16
17$obj2 = $obj;
18$obj = null;
19$map2 = $map;
20$map = null;
21
22gc_collect_cycles();
23
24var_dump($map2);
25?>
26--EXPECT--
27object(WeakMap)#1 (1) {
28  [0]=>
29  array(2) {
30    ["key"]=>
31    object(Value)#2 (1) {
32      ["value"]=>
33      string(1) "a"
34    }
35    ["value"]=>
36    object(Value)#2 (1) {
37      ["value"]=>
38      string(1) "a"
39    }
40  }
41}
42