-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Correct handling of E_USER_ERROR as fatal error if registerErrorHandl… #1670
Conversation
…er is called with callPrevious, fixes Seldaek#1669
It's impossible to test shutdown functions with PHPUnit, so I did a manual check.
use Monolog\ErrorHandler;
$logger = new Monolog\Logger('main');
$logger->pushHandler(new Monolog\Handler\StreamHandler('php://stderr', Monolog\Logger::DEBUG));
$errorHandler = new ErrorHandler($logger);
$errorHandler->registerErrorHandler([], true);
$errorHandler->registerFatalHandler();
$errorHandler->registerExceptionHandler();
trigger_error('Error', E_USER_ERROR); Before Fix.
After Fix
Conclusion: No changes, as expected
use Monolog\ErrorHandler;
$logger = new Monolog\Logger('main');
$logger->pushHandler(new Monolog\Handler\StreamHandler('php://stderr', Monolog\Logger::DEBUG));
$errorHandler = new ErrorHandler($logger);
$errorHandler->registerErrorHandler([], false);
$errorHandler->registerFatalHandler();
$errorHandler->registerExceptionHandler();
trigger_error('Error', E_USER_ERROR); Before Fix. After fix
Conclusion: Fixes the issue. Classical Fatal Error (non-cacthable by error handler use Monolog\ErrorHandler;
$logger = new Monolog\Logger('main');
$logger->pushHandler(new Monolog\Handler\StreamHandler('php://stderr', Monolog\Logger::DEBUG));
$errorHandler = new ErrorHandler($logger);
$errorHandler->registerErrorHandler([], true);
$errorHandler->registerFatalHandler();
$errorHandler->registerExceptionHandler();
include('../error_handling/error_generators/fatal_error.php');
/** Code of error_handling/error_generators/fatal_error.php
* <?php
* function my_function(array $a) { echo $a; }
* my_function(123.0);
**/ Before fix.
After fix.
Conclusion: Matching, No degradation |
Patch looks good aside from the type I commented on, thanks! 👍🏻 |
Correct handling of E_USER_ERROR as fatal error if registerErrorHandler is called with callPrevious, fixes Seldaek#1669 Co-authored-by: Jordi Boggiano <j.boggiano@seld.be>
Thanks |
…er is called with callPrevious, fixes #1669