1--TEST--
2Self-referencing map entry GC - 006
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?>
27--EXPECT--
28object(WeakMap)#1 (1) {
29  [0]=>
30  array(2) {
31    ["key"]=>
32    object(Value)#2 (1) {
33      ["value"]=>
34      string(1) "a"
35    }
36    ["value"]=>
37    object(Value)#2 (1) {
38      ["value"]=>
39      string(1) "a"
40    }
41  }
42}
43