diff options
author | Stephen Beaver <sbeaver@netgate.com> | 2015-09-18 17:16:22 -0400 |
---|---|---|
committer | Stephen Beaver <sbeaver@netgate.com> | 2015-09-18 17:16:22 -0400 |
commit | 87c59979a0624f3ea0ee1ae900b06bcd7e50c98e (patch) | |
tree | b46733a20b5ccbc3ed42c2b817519f22f230a948 /src/usr/local/www/classes/Form | |
parent | f92c948e12637b6f83da00b8581bcfc5a1032bde (diff) | |
download | pfsense-87c59979a0624f3ea0ee1ae900b06bcd7e50c98e.zip pfsense-87c59979a0624f3ea0ee1ae900b06bcd7e50c98e.tar.gz |
Fixed #5121
Obscure PHP issue with mixed variable types.
Diffstat (limited to 'src/usr/local/www/classes/Form')
-rw-r--r-- | src/usr/local/www/classes/Form/Select.class.php | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/usr/local/www/classes/Form/Select.class.php b/src/usr/local/www/classes/Form/Select.class.php index 1c4594d..c7d73c1 100644 --- a/src/usr/local/www/classes/Form/Select.class.php +++ b/src/usr/local/www/classes/Form/Select.class.php @@ -54,10 +54,17 @@ class Form_Select extends Form_Input $options = ''; foreach ($this->_values as $value => $name) { + // Things can get wierd if we have mixed types + $sval = $this->_value; + + if( (gettype($value) == "integer") && (gettype($sval) == "string") ) + $value = strval($value); + if (isset($this->_attributes['multiple'])) - $selected = in_array($value, (array)$this->_value); - else - $selected = ($this->_value == $value); + $selected = in_array($value, (array)$sval); + else { + $selected = ($sval == $value); + } $options .= '<option value="'. htmlspecialchars($value) .'"'.($selected ? ' selected' : '').'>'. htmlspecialchars(gettext($name)) .'</option>'; } |