From: Andrew Garrett Date: Wed, 29 Jul 2009 16:20:10 +0000 (+0000) Subject: Fix regression in r53316, some more intelligent handling. X-Git-Tag: 1.31.0-rc.0~40648 X-Git-Url: http://git.cyclocoop.org/%24action?a=commitdiff_plain;h=20e72c2634b4c3503dddc770fbb74b79bb9818bb;p=lhc%2Fweb%2Fwiklou.git Fix regression in r53316, some more intelligent handling. --- diff --git a/includes/HTMLForm.php b/includes/HTMLForm.php index 53cf698b16..619a0695a7 100644 --- a/includes/HTMLForm.php +++ b/includes/HTMLForm.php @@ -666,6 +666,14 @@ class HTMLSelectOrOtherField extends HTMLTextField { parent::__construct( $params ); } + + static function forceToStringRecursive( $array ) { + if ( is_array($array) ) { + return array_map( array( __CLASS__, 'forceToStringRecursive' ), $array); + } else { + return strval($array); + } + } function getInputHTML( $value ) { $valInSelect = false; @@ -675,9 +683,11 @@ class HTMLSelectOrOtherField extends HTMLTextField { HTMLFormField::flattenOptions( $this->mParams['options'] ) ); $selected = $valInSelect ? $value : 'other'; + + $opts = self::forceToStringRecursive( $this->mParams['options'] ); $select = new XmlSelect( $this->mName, $this->mID, $selected ); - $select->addOptions( array_map( 'strval', $this->mParams['options'] ) ); + $select->addOptions( $opts ); $select->setAttribute( 'class', 'mw-htmlform-select-or-other' );