X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fexception%2FMWExceptionRenderer.php;h=ca590d8ef8b831fb3f353703671d65636c308232;hb=fa0f6f34972c0e0f4aac24a03b3efdfc45f256f6;hp=22be2be05e29e52fbe81c924878997602af35f46;hpb=9b05f740f7b04c8c6d21e867e1759da4bcf75eff;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/exception/MWExceptionRenderer.php b/includes/exception/MWExceptionRenderer.php index 22be2be05e..5515ef07d7 100644 --- a/includes/exception/MWExceptionRenderer.php +++ b/includes/exception/MWExceptionRenderer.php @@ -71,14 +71,12 @@ class MWExceptionRenderer { self::getShowBacktraceError( $e ); } $message .= "\n"; + } elseif ( $wgShowExceptionDetails ) { + $message = MWExceptionHandler::getLogMessage( $e ) . + "\nBacktrace:\n" . + MWExceptionHandler::getRedactedTraceAsString( $e ) . "\n"; } else { - if ( $wgShowExceptionDetails ) { - $message = MWExceptionHandler::getLogMessage( $e ) . - "\nBacktrace:\n" . - MWExceptionHandler::getRedactedTraceAsString( $e ) . "\n"; - } else { - $message = MWExceptionHandler::getPublicLogMessage( $e ); - } + $message = MWExceptionHandler::getPublicLogMessage( $e ); } echo nl2br( htmlspecialchars( $message ) ) . "\n"; } @@ -193,18 +191,17 @@ class MWExceptionRenderer { * @param string $key Message name * @param string $fallback Default message if the message cache can't be * called by the exception - * The function also has other parameters that are arguments for the message + * @param mixed ...$params To pass to wfMessage() * @return string Message with arguments replaced */ - private static function msg( $key, $fallback /*[, params...] */ ) { + private static function msg( $key, $fallback, ...$params ) { global $wgSitename; - $args = array_slice( func_get_args(), 2 ); // FIXME: Keep logic in sync with MWException::msg. try { - $res = wfMessage( $key, $args )->text(); + $res = wfMessage( $key, ...$params )->text(); } catch ( Exception $e ) { - $res = wfMsgReplaceArgs( $fallback, $args ); + $res = wfMsgReplaceArgs( $fallback, $params ); // If an exception happens inside message rendering, // {{SITENAME}} sometimes won't be replaced. $res = strtr( $res, [ @@ -268,6 +265,7 @@ class MWExceptionRenderer { * Print a message, if possible to STDERR. * Use this in command line mode only (see isCommandLine) * + * @suppress SecurityCheck-XSS * @param string $message Failure text */ private static function printError( $message ) {