xref: /PHP-7.3/Zend/tests/try/try_finally_012.phpt (revision b746e698)
1--TEST--
2Try finally (exception in "return" statement)
3--FILE--
4<?php
5class A {
6	public $x = 1;
7	public $y = 2;
8	function __destruct() {
9		throw new Exception();
10	}
11}
12function foo() {
13	foreach(new A() as $a) {
14		try {
15			return $a;
16		} catch (Exception $e) {
17			echo "exception in foo\n";
18		} finally {
19			echo "finally\n";
20		}
21	}
22}
23try {
24	foo();
25} catch (Exception $e) {
26	echo "exception in main\n";
27}
28?>
29--EXPECT--
30finally
31exception in main
32