xref: /PHP-5.6/Zend/tests/catch_finally_003.phpt (revision 60a29791)
1--TEST--
2Try catch finally (with multi-returns)
3--FILE--
4<?php
5function dummy($msg) {
6   var_dump($msg);
7}
8
9function foo ($a) {
10   try {
11       dummy("try");
12       return $a;
13   } catch (Exception $e) {
14       throw $e;
15   } finally {
16       dummy("finally");
17       return "finally";
18   }
19   return "end";
20}
21
22function &bar($a) {
23   try {
24     echo "try\n";
25     throw new Exception("ex");
26   } catch (Exception $e) {
27   } finally {
28     return $a;
29   }
30   return ($c = "end");
31}
32var_dump(foo("para"));
33var_dump(bar("para"));
34?>
35--EXPECTF--
36string(3) "try"
37string(7) "finally"
38string(7) "finally"
39try
40string(4) "para"
41