1--TEST--
2Self-referencing map entry GC - 007
3--FILE--
4<?php
5
6class Canary extends stdClass
7{
8    public function __construct(public string $name)
9    {
10    }
11
12    function __destruct()
13    {
14        echo $this->name."\n";
15    }
16}
17
18$container = new Canary('container');
19$canary = new Canary('canary');
20$container->canary = $canary;
21
22$map = new \WeakMap();
23$map[$canary] = $container;
24
25echo 1;
26unset($container, $canary);
27gc_collect_cycles();
28echo 2;
29
30?>
31--EXPECT--
321container
33canary
342
35