1--TEST-- 2Combination of foreach, finally and goto (call order) 3--FILE-- 4<?php 5class A { 6 public $n = 0; 7 function __construct($n) { 8 $this->n = $n; 9 } 10 function __destruct() { 11 echo "destruct" . $this->n . "\n"; 12 } 13} 14 15foreach ([new A(1)] as $a) { 16 $a = null; 17 try { 18 foreach ([new A(2)] as $a) { 19 $a = null; 20 try { 21 foreach ([new A(3)] as $a) { 22 $a = null; 23 goto out; 24 } 25 } finally { 26 echo "finally1\n"; 27 } 28out: ; 29 } 30 } finally { 31 echo "finally2\n"; 32 } 33} 34?> 35--EXPECT-- 36destruct3 37finally1 38destruct2 39finally2 40destruct1 41