Fix #1905 array to string conversion in Extravar.class.php

This commit is contained in:
Kijin Sung 2022-04-25 02:21:40 +09:00
parent 742c20658f
commit a823d604de

View file

@ -192,7 +192,7 @@ class ExtraItem
* *
* @param string $type Type of variable * @param string $type Type of variable
* @param string $value Value * @param string $value Value
* @return string Returns a converted value * @return string|array Returns a converted value
*/ */
function _getTypeValue($type, $value) function _getTypeValue($type, $value)
{ {
@ -321,7 +321,7 @@ class ExtraItem
/** /**
* Returns a value for HTML * Returns a value for HTML
* *
* @return string Returns filtered value * @return string|array Returns filtered value
*/ */
function getValue() function getValue()
{ {
@ -510,7 +510,7 @@ class ExtraItem
foreach($default as $v) foreach($default as $v)
{ {
$checked = ''; $checked = '';
if(strval($value) !== '' && in_array(trim($v), $value)) if(is_array($value) && in_array(trim($v), $value))
{ {
$checked = ' checked="checked"'; $checked = ' checked="checked"';
} }
@ -528,7 +528,7 @@ class ExtraItem
foreach($default as $v) foreach($default as $v)
{ {
$selected = ''; $selected = '';
if(strval($value) !== '' && in_array(trim($v), $value)) if(is_array($value) && in_array(trim($v), $value))
{ {
$selected = ' selected="selected"'; $selected = ' selected="selected"';
} }
@ -542,7 +542,7 @@ class ExtraItem
foreach($default as $v) foreach($default as $v)
{ {
$checked = ''; $checked = '';
if(strval($value) !== '' && in_array(trim($v), $value)) if(is_array($value) && in_array(trim($v), $value))
{ {
$checked = ' checked="checked"'; $checked = ' checked="checked"';
} }