php-src/Zend/tests/bug70944.phpt

38 lines
716 B
Plaintext
Raw Normal View History

--TEST--
Bug #70944 (try{ } finally{} can create infinite chains of exceptions)
--FILE--
<?php
try {
2020-02-03 21:52:20 +00:00
$e = new Exception("Foo");
try {
throw new Exception("Bar", 0, $e);
} finally {
throw $e;
}
2015-11-21 08:27:56 +00:00
} catch (Exception $e) {
2020-02-03 21:52:20 +00:00
var_dump((string)$e);
2015-11-21 08:27:56 +00:00
}
try {
2020-02-03 21:52:20 +00:00
$e = new Exception("Foo");
try {
throw new Exception("Bar", 0, $e);
} finally {
throw new Exception("Dummy", 0, $e);
}
2015-11-21 08:27:56 +00:00
} catch (Exception $e) {
2020-02-03 21:52:20 +00:00
var_dump((string)$e);
}
?>
2015-11-21 13:01:51 +00:00
--EXPECTF--
2015-11-21 13:16:11 +00:00
string(%d) "Exception: Foo in %sbug70944.php:%d
2015-11-21 13:01:51 +00:00
Stack trace:
#0 {main}"
2015-11-21 13:16:11 +00:00
string(%d) "Exception: Foo in %sbug70944.php:%d
2015-11-21 13:01:51 +00:00
Stack trace:
#0 {main}
2015-11-21 13:16:11 +00:00
Next Exception: Dummy in %sbug70944.php:%d
2015-11-21 13:01:51 +00:00
Stack trace:
#0 {main}"