Fix PHP 8 incompatibility with debug mode enabled (#1915)

This commit is contained in:
ArthurHoaro 2022-11-25 17:16:09 +01:00 committed by GitHub
parent 611b794034
commit 4242f6955a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -48,7 +48,12 @@ if ($conf->get('dev.debug', false)) {
// See all errors (for debugging only)
error_reporting(-1);
set_error_handler(function ($errno, $errstr, $errfile, $errline, array $errcontext) {
set_error_handler(function ($errno, $errstr, $errfile, $errline, array $errcontext = []) {
// Skip PHP 8 deprecation warning with Pimple.
if (strpos($errfile, 'src/Pimple/Container.php') !== -1 && strpos($errstr, 'ArrayAccess::') !== -1) {
return error_log($errstr);
}
throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
});
}