From: Brian Wolff Date: Mon, 9 May 2011 23:27:47 +0000 (+0000) Subject: (bug 28887) Do not re-use special page objects. X-Git-Tag: 1.31.0-rc.0~30303 X-Git-Url: http://git.cyclocoop.org/%22.%28%24lien.?a=commitdiff_plain;h=73f56330402ce60e0db26a1fbdd9fa82df96df57;p=lhc%2Fweb%2Fwiklou.git (bug 28887) Do not re-use special page objects. 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. --- diff --git a/RELEASE-NOTES-1.19 b/RELEASE-NOTES-1.19 index 49906120ec..198481982a 100644 --- a/RELEASE-NOTES-1.19 +++ b/RELEASE-NOTES-1.19 @@ -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 === diff --git a/includes/SpecialPageFactory.php b/includes/SpecialPageFactory.php index eeba3ebf16..0a8bc74eca 100644 --- a/includes/SpecialPageFactory.php +++ b/includes/SpecialPageFactory.php @@ -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." );