From: Happy-melon Date: Sat, 18 Dec 2010 16:25:14 +0000 (+0000) Subject: r52070 breaks the use of optgroups etc: array(...) is cast to 'Array'. Need to only... X-Git-Tag: 1.31.0-rc.0~33242 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dcompta/comptes/journal.php?a=commitdiff_plain;h=0e79acf6a97a2939ad08029c63e164b642668a89;p=lhc%2Fweb%2Fwiklou.git r52070 breaks the use of optgroups etc: array(...) is cast to 'Array'. Need to only cast integers to strings. --- diff --git a/includes/HTMLForm.php b/includes/HTMLForm.php index 0952ebf6af..fbb17d4b44 100644 --- a/includes/HTMLForm.php +++ b/includes/HTMLForm.php @@ -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' );