From: Brian Wolff Date: Mon, 9 May 2011 06:42:48 +0000 (+0000) Subject: Make it so that when a special page is trancluded, the output won't vary by url param... X-Git-Tag: 1.31.0-rc.0~30318 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=e2bf6936b9ead39cbd4905bc6a38ca73c638fe56;p=lhc%2Fweb%2Fwiklou.git Make it so that when a special page is trancluded, the output won't vary by url parameter. This stops severe ugliness http://test.wikipedia.org/wiki/User:Bawolff/special?feed=atom where the rss feed and the html of the page is concated together. This could potentially break stuff if someone was using a transcludable special page with an html form, or if someone is actually passing parameters to the transcludable special page via the url. I'm not aware of anyone who does that, and both those things seem rather evil. --- diff --git a/RELEASE-NOTES-1.19 b/RELEASE-NOTES-1.19 index 9385aab51a..49906120ec 100644 --- a/RELEASE-NOTES-1.19 +++ b/RELEASE-NOTES-1.19 @@ -25,6 +25,7 @@ production. file description page for multi-paged documents. * (bug 28883) Message names for different compression types commonly used in Tiff files. +* When translcuding a special page, do not let it interpret url parameters. === API changes in 1.19 === diff --git a/includes/SpecialPageFactory.php b/includes/SpecialPageFactory.php index b12be2666d..eeba3ebf16 100644 --- a/includes/SpecialPageFactory.php +++ b/includes/SpecialPageFactory.php @@ -472,13 +472,18 @@ class SpecialPageFactory { * @return String: HTML fragment */ static function capturePath( &$title ) { - global $wgOut, $wgTitle; + global $wgOut, $wgTitle, $wgRequest; $oldTitle = $wgTitle; $oldOut = $wgOut; + $oldRequest = $wgRequest; + + // Don't want special pages interpreting ?feed=atom parameters. + $wgRequest = new FauxRequest( array() ); $context = new RequestContext; $context->setTitle( $title ); + $context->setRequest( $wgRequest ); $wgOut = $context->getOutput(); $ret = self::executePath( $title, $context, true ); @@ -487,6 +492,7 @@ class SpecialPageFactory { } $wgTitle = $oldTitle; $wgOut = $oldOut; + $wgRequest = $oldRequest; return $ret; } @@ -541,4 +547,4 @@ class SpecialPageFactory { return null; } } -} \ No newline at end of file +}