backtrace.phpt 425 B

123456789101112131415161718192021222324252627
  1. --TEST--
  2. Printing the stack trace in a generator
  3. --FILE--
  4. <?php
  5. function f1() {
  6. debug_print_backtrace();
  7. }
  8. function f2($arg1, $arg2) {
  9. f1();
  10. yield; // force generator
  11. }
  12. function f3($gen) {
  13. $gen->rewind(); // trigger run
  14. }
  15. $gen = f2('foo', 'bar');
  16. f3($gen);
  17. ?>
  18. --EXPECTF--
  19. #0 f1() called at [%s:%d]
  20. #1 f2(foo, bar)
  21. #2 Generator->rewind() called at [%s:%d]
  22. #3 f3(Generator Object ()) called at [%s:%d]