X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fexception%2FErrorPageError.php;h=2bed87af362d187e8504c99c29c37cccf5ea9241;hp=6366c746a36c3f155a82f0e374d7a5dfdb54dea7;hb=22806b0a4509e97b56fb52b387e17e3c80fb7eb2;hpb=ea9fcc1e4d3b572199d82c426024e3e5efe23879 diff --git a/includes/exception/ErrorPageError.php b/includes/exception/ErrorPageError.php index 6366c746a3..2bed87af36 100644 --- a/includes/exception/ErrorPageError.php +++ b/includes/exception/ErrorPageError.php @@ -24,7 +24,7 @@ * @since 1.7 * @ingroup Exception */ -class ErrorPageError extends MWException { +class ErrorPageError extends MWException implements ILocalizedException { public $title, $msg, $params; /** @@ -34,24 +34,32 @@ class ErrorPageError extends MWException { * @param string|Message $msg Message key (string) for error text, or a Message object * @param array $params Array with parameters to wfMessage() */ - public function __construct( $title, $msg, $params = array() ) { + public function __construct( $title, $msg, $params = [] ) { $this->title = $title; $this->msg = $msg; $this->params = $params; - // Bug 44111: Messages in the log files should be in English and not + // T46111: Messages in the log files should be in English and not // customized by the local wiki. So get the default English version for // passing to the parent constructor. Our overridden report() below // makes sure that the page shown to the user is not forced to English. - if ( $msg instanceof Message ) { - $enMsg = clone $msg; - } else { - $enMsg = wfMessage( $msg, $params ); - } + $enMsg = $this->getMessageObject(); $enMsg->inLanguage( 'en' )->useDatabase( false ); parent::__construct( $enMsg->text() ); } + /** + * Return a Message object for this exception + * @since 1.29 + * @return Message + */ + public function getMessageObject() { + if ( $this->msg instanceof Message ) { + return clone $this->msg; + } + return wfMessage( $this->msg, $this->params ); + } + public function report() { global $wgOut;