1--TEST--
2Try catch finally (goto in try/catch block)
3--CREDITS--
4adoy
5--FILE--
6<?php
7function foo($ex = NULL) {
8    try {
9        try {
10            goto label;
11        } finally {
12            var_dump("finally1");
13            if ($ex) throw $ex;
14        }
15    } catch (Exception $e) {
16       var_dump("catched");
17       if ($ex) return "return1";
18    } finally {
19       var_dump("finally2");
20    }
21
22label:
23   var_dump("label");
24   return "return2";
25}
26
27var_dump(foo());
28var_dump(foo(new Exception()));
29
30?>
31--EXPECTF--
32string(8) "finally1"
33string(8) "finally2"
34string(5) "label"
35string(7) "return2"
36string(8) "finally1"
37string(7) "catched"
38string(8) "finally2"
39string(7) "return1"
40