summaryrefslogtreecommitdiff
path: root/includes/exception/BadTitleError.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2015-12-20 09:00:55 +0100
committerPierre Schmitz <pierre@archlinux.de>2015-12-20 09:00:55 +0100
commita2190ac74dd4d7080b12bab90e552d7aa81209ef (patch)
tree8b31f38de9882d18df54cf8d9e0de74167a094eb /includes/exception/BadTitleError.php
parent15e69f7b20b6596b9148030acce5b59993b95a45 (diff)
parent257401d8b2cf661adf36c84b0e3fd1cf85e33c22 (diff)
Merge branch 'mw-1.26'
Diffstat (limited to 'includes/exception/BadTitleError.php')
-rw-r--r--includes/exception/BadTitleError.php16
1 files changed, 13 insertions, 3 deletions
diff --git a/includes/exception/BadTitleError.php b/includes/exception/BadTitleError.php
index e62f8bd6..039b9c60 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();
}
-
}