diff options
| author | Dmitry Stogov <dmitry@zend.com> | 2016-05-19 13:22:46 +0300 |
|---|---|---|
| committer | Dmitry Stogov <dmitry@zend.com> | 2016-05-19 13:22:46 +0300 |
| commit | 14a71cf545bf652202a3f056daefd654ad311eb5 (patch) | |
| tree | d9c1ae5271bba44da8a0918adf98013772f774e7 | |
| parent | 88196e9151e440483c22ee3974621b51dddf7df1 (diff) | |
| download | php-git-14a71cf545bf652202a3f056daefd654ad311eb5.tar.gz | |
Added and fixed tests related to "finally" handling
| -rw-r--r-- | Zend/tests/try/bug70228.phpt | 4 | ||||
| -rw-r--r-- | Zend/tests/try/bug72213.phpt | 27 | ||||
| -rw-r--r-- | Zend/tests/try/bug72213_2.phpt | 25 |
3 files changed, 54 insertions, 2 deletions
diff --git a/Zend/tests/try/bug70228.phpt b/Zend/tests/try/bug70228.phpt index 23f5864740..e85724765e 100644 --- a/Zend/tests/try/bug70228.phpt +++ b/Zend/tests/try/bug70228.phpt @@ -7,10 +7,10 @@ See https://bugs.php.net/bug.php?id=70228 function foo() { try { return str_repeat("a", 2); } - finally { return true; } + finally { return str_repeat("b", 2); } } var_dump(foo()); ?> --EXPECT-- -string(3) "bar" +string(2) "bb" diff --git a/Zend/tests/try/bug72213.phpt b/Zend/tests/try/bug72213.phpt new file mode 100644 index 0000000000..aee4c95b20 --- /dev/null +++ b/Zend/tests/try/bug72213.phpt @@ -0,0 +1,27 @@ +--TEST-- +Bug #72213 (Finally leaks on nested exceptions) +--XFAIL-- +See https://bugs.php.net/bug.php?id=72213 +--FILE-- +<?php +function test() { + try { + throw new Exception('a'); + } finally { + try { + throw new Exception('b'); + } finally { + } + } +} + +try { + test(); +} catch (Exception $e) { + var_dump($e->getMessage()); + var_dump($e->getPrevious()->getMessage()); +} +?> +--EXPECT-- +string(1) "b" +string(1) "a" diff --git a/Zend/tests/try/bug72213_2.phpt b/Zend/tests/try/bug72213_2.phpt new file mode 100644 index 0000000000..790abe125d --- /dev/null +++ b/Zend/tests/try/bug72213_2.phpt @@ -0,0 +1,25 @@ +--TEST-- +Bug #72213 (Finally leaks on nested exceptions) +--FILE-- +<?php +function test() { + try { + throw new Exception(1); + } finally { + try { + try { + throw new Exception(2); + } finally { + } + } catch (Exception $e) { + } + } +} + +try { + test(); +} catch (Exception $e) { + echo "caught {$e->getMessage()}\n"; +} +--EXPECT-- +caught 1 |
