8
0
Fork 0

throw error exceptions on error levels only

Dieser Commit ist enthalten in:
Daniel Seifert 2022-08-15 23:40:50 +02:00
Ursprung ff606efef3
Commit 236680ad7a
Signiert von: DanielS
GPG-Schlüssel-ID: 6A513E13AEE66170
1 geänderte Dateien mit 14 neuen und 11 gelöschten Zeilen

Datei anzeigen

@ -43,19 +43,22 @@ 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 ) {
// This error code is not included in error_reporting. if ( 0 === error_reporting() || !( error_reporting() & $severity ) ) {
return; // This error code is not included in error_reporting.
} return false;
}
$smartyTemplate = $this->getSmartyTemplateLocationFromError( $message ); $smartyTemplate = $this->getSmartyTemplateLocationFromError( $message );
if ( is_array( $smartyTemplate ) ) { if ( is_array( $smartyTemplate ) ) {
[ $file, $line ] = $smartyTemplate; [ $file, $line ] = $smartyTemplate;
} }
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
);
} }
} }