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