From: Andrew Garrett Date: Wed, 17 Jun 2009 19:08:14 +0000 (+0000) Subject: Fix for string/int inconsistency in value and option for imagesize, resulting in... X-Git-Tag: 1.31.0-rc.0~41317 X-Git-Url: http://git.cyclocoop.org//%22%22.str_replace%28%27%22%27%2C?a=commitdiff_plain;h=0386a9427e2cf6be07e7c87974911c577cf6f0e7;p=lhc%2Fweb%2Fwiklou.git Fix for string/int inconsistency in value and option for imagesize, resulting in unintended preference reversion. --- diff --git a/includes/HTMLForm.php b/includes/HTMLForm.php index 04b36daae4..ba44003dcd 100644 --- a/includes/HTMLForm.php +++ b/includes/HTMLForm.php @@ -601,13 +601,18 @@ class HTMLSelectField extends HTMLFormField { } function getInputHTML( $value ) { - $select = new XmlSelect( $this->mName, $this->mID, $value ); + $select = new XmlSelect( $this->mName, $this->mID, strval($value) ); + + // 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'] ); if (!empty($this->mParams['disabled'])) { $select->setAttribute( 'disabled', 'disabled' ); } - $select->addOptions( $this->mParams['options'] ); + $select->addOptions( $options ); return $select->getHTML(); }