php-src/Zend/tests/fibers/unfinished-fiber-with-finally.phpt
Aaron Piotrowski c276c16b66
Implement Fibers
RFC: https://wiki.php.net/rfc/fibers

Closes GH-6875.
2021-04-26 11:07:06 -05:00

31 lines
516 B
PHP

--TEST--
Test unfinished fiber with finally block
--FILE--
<?php
$fiber = new Fiber(function (): void {
try {
echo "fiber\n";
echo Fiber::suspend();
echo "after suspend\n";
} catch (Throwable $exception) {
echo "exit exception caught!\n";
} finally {
echo "finally\n";
}
echo "end of fiber should not be reached\n";
});
$fiber->start();
unset($fiber); // Destroy fiber object, executing finally block.
echo "done\n";
?>
--EXPECT--
fiber
finally
done