summaryrefslogtreecommitdiffstats
path: root/src/usr/local/www
diff options
context:
space:
mode:
authorStephen Beaver <sbeaver@netgate.com>2015-09-18 17:16:22 -0400
committerStephen Beaver <sbeaver@netgate.com>2015-09-18 17:16:22 -0400
commit87c59979a0624f3ea0ee1ae900b06bcd7e50c98e (patch)
treeb46733a20b5ccbc3ed42c2b817519f22f230a948 /src/usr/local/www
parentf92c948e12637b6f83da00b8581bcfc5a1032bde (diff)
downloadpfsense-87c59979a0624f3ea0ee1ae900b06bcd7e50c98e.zip
pfsense-87c59979a0624f3ea0ee1ae900b06bcd7e50c98e.tar.gz
Fixed #5121
Obscure PHP issue with mixed variable types.
Diffstat (limited to 'src/usr/local/www')
-rw-r--r--src/usr/local/www/classes/Form/Select.class.php13
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>';
}
OpenPOWER on IntegriCloud