X-Git-Url: http://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fexception%2FMWExceptionRenderer.php;h=5d75036566f616c5ccf3bbfb18f1ac23f8b86558;hp=60d760f3aa2bba4df3cc107009bd9ee6c422e3f6;hb=0e339243f1dbbba5f87a54b116c23e0daec8e2e4;hpb=64b83bdb3afd0ee4f8fc1893a865409c198e601e diff --git a/includes/exception/MWExceptionRenderer.php b/includes/exception/MWExceptionRenderer.php index 60d760f3aa..5d75036566 100644 --- a/includes/exception/MWExceptionRenderer.php +++ b/includes/exception/MWExceptionRenderer.php @@ -33,7 +33,7 @@ class MWExceptionRenderer { /** * @param Exception|Throwable $e Original exception - * @param integer $mode MWExceptionExposer::AS_* constant + * @param int $mode MWExceptionExposer::AS_* constant * @param Exception|Throwable|null $eNew New exception from attempting to show the first */ public static function output( $e, $mode, $eNew = null ) { @@ -47,13 +47,15 @@ class MWExceptionRenderer { self::printError( self::getText( $e ) ); } elseif ( $mode === self::AS_PRETTY ) { self::statusHeader( 500 ); + self::header( "Content-Type: $wgMimeType; charset=utf-8" ); if ( $e instanceof DBConnectionError ) { self::reportOutageHTML( $e ); } else { - self::header( "Content-Type: $wgMimeType; charset=utf-8" ); self::reportHTML( $e ); } } else { + self::statusHeader( 500 ); + self::header( "Content-Type: $wgMimeType; charset=utf-8" ); if ( $eNew ) { $message = "MediaWiki internal error.\n\n"; if ( self::showBackTrace( $e ) ) { @@ -90,7 +92,7 @@ class MWExceptionRenderer { private static function useOutputPage( $e ) { // Can the extension use the Message class/wfMessage to get i18n-ed messages? foreach ( $e->getTrace() as $frame ) { - if ( isset( $frame['class'] ) && $frame['class'] === 'LocalisationCache' ) { + if ( isset( $frame['class'] ) && $frame['class'] === LocalisationCache::class ) { return false; } } @@ -128,7 +130,7 @@ class MWExceptionRenderer { // Show any custom GUI message before the details if ( $e instanceof MessageSpecifier ) { - $wgOut->addHTML( Message::newFromSpecifier( $e )->escaped() ); + $wgOut->addHTML( Html::element( 'p', [], Message::newFromSpecifier( $e )->text() ) ); } $wgOut->addHTML( self::getHTML( $e ) ); @@ -169,14 +171,15 @@ class MWExceptionRenderer { } else { $logId = WebRequest::getRequestId(); $html = "
$again
$info
"; + $html = "\n" . + '' . + '$again
$info
"; if ( $wgShowDBErrorBacktrace ) { $html .= 'Backtrace:
' . htmlspecialchars( $e->getTraceAsString() ) . ''; } - $html .= '