X-Git-Url: https://git.cyclocoop.org/%242?a=blobdiff_plain;f=includes%2Fexception%2FBadTitleError.php;h=039b9c60cced3d4c83e7cf1211a43f0d3759f64e;hb=f1a890c34cebd8744bf3a6277734275fb975575a;hp=e62f8bd6fad75ea84f81552a228183440ae59676;hpb=5ba12e2896a71d5ae8be2f404934e2dbe1f0abbc;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/exception/BadTitleError.php b/includes/exception/BadTitleError.php index e62f8bd6fa..039b9c60cc 100644 --- a/includes/exception/BadTitleError.php +++ b/includes/exception/BadTitleError.php @@ -28,11 +28,22 @@ */ class BadTitleError extends ErrorPageError { /** - * @param string|Message $msg A message key (default: 'badtitletext') + * @param string|Message|MalformedTitleException $msg A message key (default: 'badtitletext'), or + * a MalformedTitleException to figure out things from * @param array $params Parameter to wfMessage() */ public function __construct( $msg = 'badtitletext', $params = array() ) { - parent::__construct( 'badtitle', $msg, $params ); + if ( $msg instanceof MalformedTitleException ) { + $errorMessage = $msg->getErrorMessage(); + if ( !$errorMessage ) { + parent::__construct( 'badtitle', 'badtitletext', array() ); + } else { + $errorMessageParams = $msg->getErrorMessageParameters(); + parent::__construct( 'badtitle', $errorMessage, $errorMessageParams ); + } + } else { + parent::__construct( 'badtitle', $msg, $params ); + } } /** @@ -47,5 +58,4 @@ class BadTitleError extends ErrorPageError { $wgOut->setStatusCode( 400 ); parent::report(); } - }