failing-fiber.phpt 474 B

12345678910111213141516171819202122232425
  1. --TEST--
  2. Test throwing from fiber
  3. --FILE--
  4. <?php
  5. $fiber = new Fiber(function (): void {
  6. Fiber::suspend('test');
  7. throw new Exception('test');
  8. });
  9. $value = $fiber->start();
  10. var_dump($value);
  11. $fiber->resume($value);
  12. ?>
  13. --EXPECTF--
  14. string(4) "test"
  15. Fatal error: Uncaught Exception: test in %sfailing-fiber.php:%d
  16. Stack trace:
  17. #0 [internal function]: {closure}()
  18. #1 %sfailing-fiber.php(%d): Fiber->resume('test')
  19. #2 {main}
  20. thrown in %sfailing-fiber.php on line %d