summaryrefslogtreecommitdiff
path: root/includes/exception/BadTitleError.php
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-05-01 15:32:59 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-05-01 15:32:59 -0400
commit6dc1997577fab2c366781fd7048144935afa0012 (patch)
tree8918d28c7ab4342f0738985e37af1dfc42d0e93a /includes/exception/BadTitleError.php
parent150f94f051128f367bc89f6b7e5f57eb2a69fc62 (diff)
parentfa89acd685cb09cdbe1c64cbb721ec64975bbbc1 (diff)
Merge commit 'fa89acd'
# Conflicts: # .gitignore # extensions/ArchInterWiki.sql
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();
}
-
}