1--TEST--
2Self-referencing map entry GC - 016
3--FILE--
4<?php
5
6class K1 { function __construct() {} }
7class K2 {}
8
9$map = new WeakMap();
10$k1 = new K1();
11$map[$k1] = [$k1, $map];
12
13$k2 = new K2();
14$map[$k2] = $k2;
15
16gc_collect_cycles();
17
18var_dump($map);
19?>
20--EXPECT--
21object(WeakMap)#1 (2) {
22  [0]=>
23  array(2) {
24    ["key"]=>
25    object(K1)#2 (0) {
26    }
27    ["value"]=>
28    array(2) {
29      [0]=>
30      object(K1)#2 (0) {
31      }
32      [1]=>
33      *RECURSION*
34    }
35  }
36  [1]=>
37  array(2) {
38    ["key"]=>
39    object(K2)#3 (0) {
40    }
41    ["value"]=>
42    object(K2)#3 (0) {
43    }
44  }
45}
46