Make it so that when a special page is trancluded, the output won't vary by url param...
authorBrian Wolff <bawolff@users.mediawiki.org>
Mon, 9 May 2011 06:42:48 +0000 (06:42 +0000)
committerBrian Wolff <bawolff@users.mediawiki.org>
Mon, 9 May 2011 06:42:48 +0000 (06:42 +0000)
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.

RELEASE-NOTES-1.19
includes/SpecialPageFactory.php

index 9385aab..4990612 100644 (file)
@@ -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 ===
 
index b12be26..eeba3eb 100644 (file)
@@ -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
+}