mirror of
https://github.com/php/php-src.git
synced 2024-12-13 20:05:26 +08:00
8c6a7c3326
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.
30 lines
583 B
PHP
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
|