# 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(
- create_function('$opt', 'return is_int($opt) ? strval($opt) : $opt;'),
- $this->mParams['options']
- );
+ foreach( $this->mParams['options'] as $key => &$opt ){
+ if( is_int( $opt ) ){
+ $opt = strval( $opt );
+ }
+ }
+ unset( $opt ); # PHP keeps $opt around as a reference, which is a bit scary
if ( !empty( $this->mParams['disabled'] ) ) {
$select->setAttribute( 'disabled', 'disabled' );
}
- $select->addOptions( $options );
+ $select->addOptions( $this->mParams['options'] );
return $select->getHTML();
}