X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fexception%2FMWExceptionHandler.php;h=b125f58c48e14d62097d8a23ea36c4d1f5140eda;hp=d863a2bb583c2b9cc6417b6971eb249375be6b6f;hb=8fd5a99f4e261d37cd7237a1992b1bcf03a764d3;hpb=495e8ddf7e6940777f3318a1a2e37d85bfdbdbf1 diff --git a/includes/exception/MWExceptionHandler.php b/includes/exception/MWExceptionHandler.php index d863a2bb58..b125f58c48 100644 --- a/includes/exception/MWExceptionHandler.php +++ b/includes/exception/MWExceptionHandler.php @@ -170,6 +170,8 @@ class MWExceptionHandler { public static function handleError( $level, $message, $file = null, $line = null ) { + global $wgPropagateErrors; + if ( in_array( $level, self::$fatalErrorTypes ) ) { return call_user_func_array( 'MWExceptionHandler::handleFatalError', func_get_args() @@ -213,9 +215,10 @@ class MWExceptionHandler { $e = new ErrorException( "PHP $levelName: $message", 0, $level, $file, $line ); self::logError( $e, 'error', $severity ); - // This handler is for logging only. Return false will instruct PHP - // to continue regular handling. - return false; + // If $wgPropagateErrors is true return false so PHP shows/logs the error normally. + // Ignore $wgPropagateErrors if the error should break execution, or track_errors is set + // (which means someone is counting on regular PHP error handling behavior). + return !( $wgPropagateErrors || $level == E_RECOVERABLE_ERROR || ini_get( 'track_errors' ) ); } /** @@ -300,7 +303,7 @@ TXT; $logger = LoggerFactory::getInstance( 'fatal' ); $logger->error( $msg, [ 'fatal_exception' => [ - 'class' => 'ErrorException', + 'class' => ErrorException::class, 'message' => "PHP Fatal Error: {$message}", 'code' => $level, 'file' => $file,