1--TEST--
2Self-referencing map entry GC - 008
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$canary = new Canary('canary');
19
20$map = new \WeakMap();
21$map[$canary] = $canary;
22
23echo 1;
24unset($canary);
25gc_collect_cycles();
26echo 2;
27
28--EXPECT--
291canary
302
31