throw error exceptions on error levels only

This commit is contained in:
Daniel Seifert 2022-08-15 23:40:50 +02:00
parent ff606efef3
commit 236680ad7a
Signed by: DanielS
GPG Key ID: 6A513E13AEE66170
1 changed files with 14 additions and 11 deletions

View File

@ -43,10 +43,11 @@ class ShopControl_DebugBar extends ShopControl_DebugBar_parent
public function d3DebugBarSetErrorHandler() public function d3DebugBarSetErrorHandler()
{ {
if ($this->d3CanActivateDebugBar()) { if ($this->d3CanActivateDebugBar()) {
set_error_handler( function( $severity, $message, $file, $line ) { set_error_handler(
if ( ! ( error_reporting() & $severity ) ) { function( $severity, $message, $file, $line ) {
if ( 0 === error_reporting() || !( error_reporting() & $severity ) ) {
// This error code is not included in error_reporting. // This error code is not included in error_reporting.
return; return false;
} }
$smartyTemplate = $this->getSmartyTemplateLocationFromError( $message ); $smartyTemplate = $this->getSmartyTemplateLocationFromError( $message );
@ -55,7 +56,9 @@ class ShopControl_DebugBar extends ShopControl_DebugBar_parent
} }
throw new ErrorException( $message, 0, $severity, $file, $line ); throw new ErrorException( $message, 0, $severity, $file, $line );
} ); },
E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | E_RECOVERABLE_ERROR
);
} }
} }