* (bug 12588) Fix selection in namespace selector on Special:Newpages
authorBrion Vibber <brion@users.mediawiki.org>
Fri, 11 Jan 2008 21:10:51 +0000 (21:10 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Fri, 11 Jan 2008 21:10:51 +0000 (21:10 +0000)
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
includes/Xml.php

index 5e1e32f..f603bfe 100644 (file)
@@ -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 ==
index fe4bb0c..650ad04 100644 (file)
@@ -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 ) {