From 0386a9427e2cf6be07e7c87974911c577cf6f0e7 Mon Sep 17 00:00:00 2001 From: Andrew Garrett Date: Wed, 17 Jun 2009 19:08:14 +0000 Subject: [PATCH] Fix for string/int inconsistency in value and option for imagesize, resulting in unintended preference reversion. --- includes/HTMLForm.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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(); } -- 2.20.1