mirror of
https://github.com/php/php-src.git
synced 2024-09-21 18:07:23 +00:00
c276c16b66
RFC: https://wiki.php.net/rfc/fibers Closes GH-6875.
31 lines
516 B
PHP
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
|