exception_during_shutdown.phpt 565 B

123456789101112131415161718192021222324252627282930
  1. --TEST--
  2. Generator exceptions during shutdown should not be swallowed
  3. --FILE--
  4. <?php
  5. function gen() {
  6. try {
  7. echo "before yield\n";
  8. yield;
  9. echo "after yield\n";
  10. } finally {
  11. echo "before yield in finally\n";
  12. yield;
  13. echo "after yield in finally\n";
  14. }
  15. echo "after finally\n";
  16. }
  17. $gen = gen();
  18. $gen->rewind();
  19. ?>
  20. --EXPECTF--
  21. before yield
  22. before yield in finally
  23. Fatal error: Uncaught Error: Cannot yield from finally in a force-closed generator in %s:%d
  24. Stack trace:
  25. #0 {main}
  26. thrown in %s on line %d