summaryrefslogtreecommitdiff
path: root/Zend/tests/catch_finally_006.phpt
diff options
context:
space:
mode:
authorXinchen Hui <laruence@php.net>2012-08-13 21:48:39 +0800
committerXinchen Hui <laruence@php.net>2012-08-13 21:48:39 +0800
commit80d5ae3cea4c6fdd85789edfde0e2da721a0741b (patch)
tree832b983601ab2007dc27ec83a3909b97ce2f89b4 /Zend/tests/catch_finally_006.phpt
parente51acee43ddcb03f6b695f40fbf4956c8859a4aa (diff)
downloadphp-git-80d5ae3cea4c6fdd85789edfde0e2da721a0741b.tar.gz
Implemented 'finally' keywords for php
RFC: https://wiki.php.net/rfc/finally FR: https://bugs.php.net/bug.php?id=32100 and I have got some improvment ideas(performance), will implemented later. thanks
Diffstat (limited to 'Zend/tests/catch_finally_006.phpt')
-rw-r--r--Zend/tests/catch_finally_006.phpt28
1 files changed, 28 insertions, 0 deletions
diff --git a/Zend/tests/catch_finally_006.phpt b/Zend/tests/catch_finally_006.phpt
new file mode 100644
index 0000000000..48937c40d4
--- /dev/null
+++ b/Zend/tests/catch_finally_006.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Try catch finally: re-throw exception in catch block
+--FILE--
+<?php
+function foo ($a) {
+ try {
+ throw new Exception("ex");
+ } catch (Exception $e) {
+ var_dump($a);
+ throw $e;
+ } finally {
+ var_dump("finally");
+ return "return";
+ }
+ return 1;
+}
+
+try {
+ var_dump(foo("para"));
+} catch (Exception $e) {
+ "caught exception" . PHP_EOL;
+ var_dump($e->getMessage());
+}
+?>
+--EXPECT--
+string(4) "para"
+string(7) "finally"
+string(2) "ex"