mirror of
https://github.com/php/php-src.git
synced 2026-04-24 00:18:23 +02:00
1173c2e64a
Generators that suspended a fiber should not be dtor because they will be executed during the fiber dtor. Fiber dtor throws an exception in the fiber's context in order to unwind and execute finally blocks, which will also properly dtor the generator. Fixes GH-9916
26 lines
499 B
PHP
26 lines
499 B
PHP
--TEST--
|
|
Bug GH-9916 005 (Entering shutdown sequence with a fiber suspended in a Generator emits an unavoidable fatal error or crashes)
|
|
--FILE--
|
|
<?php
|
|
$gen = (function() {
|
|
$x = new stdClass;
|
|
$fiber = yield;
|
|
print "Before suspend\n";
|
|
Fiber::suspend();
|
|
yield;
|
|
})();
|
|
$fiber = new Fiber(function() use ($gen, &$fiber) {
|
|
$gen->send($fiber);
|
|
$gen->current();
|
|
});
|
|
$fiber->start();
|
|
|
|
$gen = null;
|
|
$fiber = null;
|
|
gc_collect_cycles();
|
|
?>
|
|
==DONE==
|
|
--EXPECT--
|
|
Before suspend
|
|
==DONE==
|