php-src/Zend/tests/bug63206.phpt
Mark Plomer 8c6a7c3326 Fix #63206: Fully support error/exception_handler stacking, even with null or inside the handler
Always push the current user_error/exception_handler to the stack,
even when it is empty, so restore_error_handler() always works as
expected.

The user_error_handler is especially temporarily empty when we are inside
the error handler, which caused inconsistent behaviour before.
2020-02-25 12:43:42 +01:00

30 lines
583 B
PHP

--TEST--
Bug #63206 Fully support error_handler stacking, even inside the error_handler
--FILE--
<?php
set_error_handler(function() {
echo 'First handler' . PHP_EOL;
});
set_error_handler(function() {
echo 'Second handler' . PHP_EOL;
set_error_handler(function() {
echo 'Internal handler' . PHP_EOL;
});
$triggerInternalNotice++; // warnings while handling the error should go into internal handler
restore_error_handler();
});
$triggerNotice1++;
$triggerNotice2++;
?>
--EXPECTF--
Second handler
Internal handler
Second handler
Internal handler