temporary_cleaning_009.phpt 577 B

123456789101112131415161718192021222324252627
  1. --TEST--
  2. Live range & free on return
  3. --FILE--
  4. <?php
  5. class bar {
  6. public $foo = 1;
  7. public $bar = 1;
  8. function __destruct() {
  9. throw $this->foo;
  10. }
  11. }
  12. foreach (new bar as &$foo) {
  13. try {
  14. $foo = new Exception;
  15. return; // frees the loop variable
  16. } catch (Exception $e) {
  17. echo "exception\n";
  18. }
  19. }
  20. echo "end\n";
  21. ?>
  22. --EXPECTF--
  23. Fatal error: Uncaught Exception in %stemporary_cleaning_009.php:12
  24. Stack trace:
  25. #0 {main}
  26. thrown in %stemporary_cleaning_009.php on line 12