throw.phpt 353 B

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