throw_caught.phpt 422 B

123456789101112131415161718192021222324252627
  1. --TEST--
  2. Generator::throw() where the exception is caught in the generator
  3. --FILE--
  4. <?php
  5. function gen() {
  6. echo "before yield\n";
  7. try {
  8. yield;
  9. } catch (RuntimeException $e) {
  10. echo $e, "\n\n";
  11. }
  12. yield 'result';
  13. }
  14. $gen = gen();
  15. var_dump($gen->throw(new RuntimeException('Test')));
  16. ?>
  17. --EXPECTF--
  18. before yield
  19. RuntimeException: Test in %s:%d
  20. Stack trace:
  21. #0 {main}
  22. string(6) "result"