From: Brion Vibber Date: Fri, 11 Jan 2008 21:10:51 +0000 (+0000) Subject: * (bug 12588) Fix selection in namespace selector on Special:Newpages X-Git-Tag: 1.31.0-rc.0~50055 X-Git-Url: http://git.cyclocoop.org/%40spipnet%40?a=commitdiff_plain;h=83ece527d751b5f82489056981f195b729bb905d;p=lhc%2Fweb%2Fwiklou.git * (bug 12588) Fix selection in namespace selector on Special:Newpages Godawful hack... we'll be frequently passed selected namespaces as strings since PHP is such a shithole. But we also don't want blanks and nulls and "all"s matching 0, so let's convert *just* string ints to clean ints. --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 5e1e32f47a..f603bfeb52 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -297,6 +297,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 12505) Fixed section=0 with action=raw * Do not log user rights change that didn't change anything * (bug 12584) Don't reset cl_timestamp when auto-updating sort key on move +* (bug 12588) Fix selection in namespace selector on Special:Newpages == Parser changes in 1.12 == diff --git a/includes/Xml.php b/includes/Xml.php index fe4bb0cdec..650ad041fc 100644 --- a/includes/Xml.php +++ b/includes/Xml.php @@ -104,6 +104,14 @@ class Xml { $namespaces = $wgContLang->getFormattedNamespaces(); $options = array(); + // Godawful hack... we'll be frequently passed selected namespaces + // as strings since PHP is such a shithole. + // But we also don't want blanks and nulls and "all"s matching 0, + // so let's convert *just* string ints to clean ints. + if( preg_match( '/^\d+$/', $selected ) ) { + $selected = intval( $selected ); + } + if( !is_null( $all ) ) $namespaces = array( $all => wfMsg( 'namespacesall' ) ) + $namespaces; foreach( $namespaces as $index => $name ) {