(bug 28887) Do not re-use special page objects.
authorBrian Wolff <bawolff@users.mediawiki.org>
Mon, 9 May 2011 23:27:47 +0000 (23:27 +0000)
committerBrian Wolff <bawolff@users.mediawiki.org>
Mon, 9 May 2011 23:27:47 +0000 (23:27 +0000)
This causes bugs where if you do
{{special:recentchanges/3}} and {{special:recentchanges/15}} the first one is used for both
since the property is stored in a member variable of the class, which is then saved.

MediaWiki seems to have reused the special page classes since forever. I'm not sure why.
I can't imagine anyone relying on this behaviour, and it seems rather unexpected behaviour.

RELEASE-NOTES-1.19
includes/SpecialPageFactory.php

index 4990612..1984819 100644 (file)
@@ -26,6 +26,7 @@ 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.
+* (bug 28887) Special page classes are no longer re-used during 1 request.
 
 === API changes in 1.19 ===
 
index eeba3eb..0a8bc74 100644 (file)
@@ -314,7 +314,7 @@ class SpecialPageFactory {
                        $rec = self::getList()->$realName;
                        if ( is_string( $rec ) ) {
                                $className = $rec;
-                               self::getList()->$realName = new $className;
+                               return new $className;
                        } elseif ( is_array( $rec ) ) {
                                // @deprecated, officially since 1.18, unofficially since forever
                                wfDebug( "Array syntax for \$wgSpecialPages is deprecated, define a subclass of SpecialPage instead." );