Open
Description
Description
Found this while checking if #9916 also happened during GC.
The following code:
<?php
class Canary {
public function __construct(
public readonly string $x,
) {
}
public function __destruct() {
var_dump($this->x);
}
}
$gen = (function() {
$canary = new Canary('Generator dtor');
$fiber = yield;
Fiber::suspend();
})();
$fiber = new Fiber(function() use ($gen, &$fiber) {
$canary = new Canary('Fiber dtor');
$gen->send($fiber);
});
$fiber->start();
$gen = null;
$fiber = null;
gc_collect_cycles();
var_dump('Shutdown');
Resulted in this output:
string(8) "Shutdown"
string(14) "Generator dtor"
string(10) "Fiber dtor"
But I expected this output instead:
string(14) "Generator dtor"
string(10) "Fiber dtor"
string(8) "Shutdown"
PHP Version
PHP 8.1
Operating System
No response