php-src/Zend/tests/bug70944.phpt

38 lines
662 B
Plaintext
Raw Normal View History

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