From: Mormegil Date: Sat, 20 Apr 2013 12:42:22 +0000 (+0200) Subject: (bug 47449) {{#special:}} should always return a usable title X-Git-Tag: 1.31.0-rc.0~19423 X-Git-Url: https://git.cyclocoop.org/%28%28?a=commitdiff_plain;h=7fadd2c9f3fb8914f5ac4aabddbb761d66427c64;p=lhc%2Fweb%2Fwiklou.git (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 --- diff --git a/includes/parser/CoreParserFunctions.php b/includes/parser/CoreParserFunctions.php index 375ff2b9bf..a7820d4b6a 100644 --- a/includes/parser/CoreParserFunctions.php +++ b/includes/parser/CoreParserFunctions.php @@ -824,7 +824,9 @@ class CoreParserFunctions { $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 21a6b864e5..5c3542176e 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -7400,9 +7400,9 @@ Special:RecentChanges/param !! options msg !! input -{{#special:foobarnonexistent}} +{{#special:foobar nonexistent}} !! result -No such special page +Special:Foobar nonexistent !! end !! test @@ -7430,9 +7430,9 @@ Special:RecentChanges/param !! options msg !! input -{{#speciale:foobarnonexistent}} +{{#speciale:foobar nonexistent}} !! result -No_such_special_page +Special:Foobar_nonexistent !! end ### @@ -13969,6 +13969,19 @@ abc

!! end +!!test +Special parser function +!! input +{{#special:RandomPage}} +{{#special:BaDtItLe}} +{{#special:Foobar}} +!! result +

Special:Random +Special:Badtitle +Special:Foobar +

+!! end + !!test Bug 34939 - Case insensitive link parsing ([HttP://]) !! input