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