xref: /PHP-7.3/Zend/tests/try/try_finally_022.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}
12try{
13	$a = 0;
14	switch ($a) {
15		case 0:
16	}
17	switch ($a) {
18		case 0:
19	}
20	switch ($a) {
21		case 0:
22	}
23	foreach([new stdClass()] as $x) {
24		foreach(new A() as $a) {
25			foreach([new stdClass()] as $y) {
26				try {
27					if (0) { echo "0" . (int)5; }
28					return $a;
29				} catch (Exception $e) {
30					echo "exception1\n";
31				}
32			}
33		}
34	}
35} catch (Exception $e) {
36	echo "exception2\n";
37}
38?>
39--EXPECT--
40exception2
41