From 83ece527d751b5f82489056981f195b729bb905d Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Fri, 11 Jan 2008 21:10:51 +0000 Subject: [PATCH] * (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. --- RELEASE-NOTES | 1 + includes/Xml.php | 8 ++++++++ 2 files changed, 9 insertions(+) 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 ) { -- 2.20.1