suspend-in-force-close-fiber-catching-exception.phpt 500 B

123456789101112131415161718192021222324252627
  1. --TEST--
  2. Suspend in force-closed fiber, catching exception thrown from destructor
  3. --FILE--
  4. <?php
  5. try {
  6. (function (): void {
  7. $fiber = new Fiber(function (): void {
  8. try {
  9. Fiber::suspend();
  10. } finally {
  11. Fiber::suspend();
  12. }
  13. });
  14. $fiber->start();
  15. })();
  16. } catch (FiberError $exception) {
  17. echo $exception->getMessage(), "\n";
  18. }
  19. echo "done\n";
  20. ?>
  21. --EXPECT--
  22. Cannot suspend in a force-closed fiber
  23. done