jenkins-bot has submitted this change and it was merged.
Change subject: (bug 47449) {{#special:}} should always return a usable title
......................................................................
(bug 47449) {{#special:}} should always return a usable title
{{#special:}} should always return a usable title in NS_SPECIAL,
even when given an unknown special page title. Currently, it returns
"No such special page" text for such unknown names, which is
surprising.
Bug: 47449
Change-Id: I7f184956ec9d56c849f201f1230736fcedd0fadf
---
M includes/parser/CoreParserFunctions.php
M tests/parser/parserTests.txt
2 files changed, 20 insertions(+), 5 deletions(-)
Approvals:
Tim Starling: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/parser/CoreParserFunctions.php
b/includes/parser/CoreParserFunctions.php
index 375ff2b..a7820d4 100644
--- a/includes/parser/CoreParserFunctions.php
+++ b/includes/parser/CoreParserFunctions.php
@@ -824,7 +824,9 @@
$title = SpecialPage::getTitleFor( $page, $subpage );
return $title->getPrefixedText();
} else {
- return wfMessage( 'nosuchspecialpage'
)->inContentLanguage()->text();
+ // unknown special page, just use the given text as its
title, if at all possible
+ $title = Title::makeTitleSafe( NS_SPECIAL, $text );
+ return $title ? $title->getPrefixedText() :
self::special( $parser, 'Badtitle' );
}
}
diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt
index 21a6b86..5c35421 100644
--- a/tests/parser/parserTests.txt
+++ b/tests/parser/parserTests.txt
@@ -7400,9 +7400,9 @@
!! options
msg
!! input
-{{#special:foobarnonexistent}}
+{{#special:foobar nonexistent}}
!! result
-No such special page
+Special:Foobar nonexistent
!! end
!! test
@@ -7430,9 +7430,9 @@
!! options
msg
!! input
-{{#speciale:foobarnonexistent}}
+{{#speciale:foobar nonexistent}}
!! result
-No_such_special_page
+Special:Foobar_nonexistent
!! end
###
@@ -13970,6 +13970,19 @@
!! end
!!test
+Special parser function
+!! input
+{{#special:RandomPage}}
+{{#special:BaDtItLe}}
+{{#special:Foobar}}
+!! result
+<p>Special:Random
+Special:Badtitle
+Special:Foobar
+</p>
+!! end
+
+!!test
Bug 34939 - Case insensitive link parsing ([HttP://])
!! input
[HttP://MediaWiki.Org/]
--
To view, visit https://gerrit.wikimedia.org/r/60105
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I7f184956ec9d56c849f201f1230736fcedd0fadf
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Mormegil <[email protected]>
Gerrit-Reviewer: Daniel Friesen <[email protected]>
Gerrit-Reviewer: Nikerabbit <[email protected]>
Gerrit-Reviewer: Tim Starling <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits