* (bug 27680) Fix for r82273: wgCanonicalSpecialPageName no longer false when request...
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Fri, 25 Feb 2011 11:48:14 +0000 (11:48 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Fri, 25 Feb 2011 11:48:14 +0000 (11:48 +0000)
The problem is that in this case $wgOut's Title object is not exactely the same $wgTitle because of line 600 of SpecialPage:
$wgTitle = $page->getTitle();
which strips the subpage parameter. Now using SpecialPage::resolveAliasWithSubpage() so that it works in all cases.

Also PHP strikes again for not allowing SpecialPage::resolveAliasWithSubpage( $title->getDBkey() )[0] syntax. YAY :)

includes/OutputPage.php

index 39c5062..7f343b4 100644 (file)
@@ -2611,11 +2611,16 @@ class OutputPage {
                $title = $this->getTitle();
                $ns = $title->getNamespace();
                $nsname = MWNamespace::exists( $ns ) ? MWNamespace::getCanonicalName( $ns ) : $title->getNsText();
+               if ( $ns == NS_SPECIAL ) {
+                       $parts = SpecialPage::resolveAliasWithSubpage( $title->getDBkey() );
+                       $canonicalName = $parts[0];
+               } else {
+                       $canonicalName = false; # bug 21115
+               }
 
                $vars = array(
                        'wgCanonicalNamespace' => $nsname,
-                       'wgCanonicalSpecialPageName' => $ns == NS_SPECIAL ?
-                               SpecialPage::resolveAlias( $title->getDBkey() ) : false, # bug 21115
+                       'wgCanonicalSpecialPageName' => $canonicalName,
                        'wgNamespaceNumber' => $title->getNamespace(),
                        'wgPageName' => $title->getPrefixedDBKey(),
                        'wgTitle' => $title->getText(),