r52070 breaks the use of optgroups etc: array(...) is cast to 'Array'. Need to only...
authorHappy-melon <happy-melon@users.mediawiki.org>
Sat, 18 Dec 2010 16:25:14 +0000 (16:25 +0000)
committerHappy-melon <happy-melon@users.mediawiki.org>
Sat, 18 Dec 2010 16:25:14 +0000 (16:25 +0000)
includes/HTMLForm.php

index 0952ebf..fbb17d4 100644 (file)
@@ -1222,7 +1222,10 @@ class HTMLSelectField extends HTMLFormField {
                # If one of the options' 'name' is int(0), it is automatically selected.
                # because PHP sucks and things int(0) == 'some string'.
                # Working around this by forcing all of them to strings.
-               $options = array_map( 'strval', $this->mParams['options'] );
+               $options = array_map( 
+                       create_function('$opt', 'return is_int($opt) ? strval($opt) : $opt;'),
+                       $this->mParams['options'] 
+               );
 
                if ( !empty( $this->mParams['disabled'] ) ) {
                        $select->setAttribute( 'disabled', 'disabled' );