From: Alexandre Emsenhuber Date: Fri, 25 Feb 2011 11:48:14 +0000 (+0000) Subject: * (bug 27680) Fix for r82273: wgCanonicalSpecialPageName no longer false when request... X-Git-Tag: 1.31.0-rc.0~31777 X-Git-Url: https://git.cyclocoop.org/%7B%7B%20url_for%28%27votes%27%2C%20votes=%27waiting%27%29%20%7D%7D?a=commitdiff_plain;h=477e6e0610b57ffcad689012901c71d841e571b3;p=lhc%2Fweb%2Fwiklou.git * (bug 27680) Fix for r82273: wgCanonicalSpecialPageName no longer false when requesting a special page with subpage parameter 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 :) --- diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 39c50621aa..7f343b4b69 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -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(),