php-src/Zend/tests/exit_finally_2.phpt
Nikita Popov 75a04eac97 Make exit() unwind properly
exit() is now internally implemented by throwing an exception,
performing a normal stack unwind and a clean shutdown. This ensures
that no persistent resource leaks occur.

The exception is internal, cannot be caught and does not result in
the execution of finally blocks. This may be relaxed in the future.

Closes GH-5768.
2020-06-29 15:50:12 +02:00

24 lines
394 B
PHP

--TEST--
exit() and finally (2)
--FILE--
<?php
// TODO: In the future, we should execute the finally block.
try {
try {
exit("Exit\n");
} catch (Throwable $e) {
echo "Not caught\n";
} finally {
throw new Exception("Finally exception");
}
echo "Not executed\n";
} catch (Exception $e) {
echo "Caught {$e->getMessage()}\n";
}
?>
--EXPECT--
Exit