php-src/Zend/tests/try/try_finally_recursive_previous.phpt
Nikita Popov 1a2fb90bf4 Fix finally exception chaining on recursion
In this case zend_exception_set_previous() would destroy the
fast_call exception and further accesses on ex would be invalid.
We should only update ex if we update EG(exception).

Fixes oss-fuzz #40464.
2021-11-01 11:44:32 +01:00

18 lines
356 B
PHP

--TEST--
Test case where the implicit previous finally exception would result in recursion
--FILE--
<?php
try {
$e = new Exception("M1");
try {
throw new Exception("M2", 0, $e);
} finally {
throw $e;
}
} finally {}
?>
--EXPECTF--
Fatal error: Uncaught Exception: M1 in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d