mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 02:44:27 +02:00
strict comparason didn't work in all cases. use type-casting now.
This commit is contained in:
@@ -73,7 +73,7 @@ function smarty_function_html_checkboxes($params, &$smarty)
|
|||||||
|
|
||||||
case 'checked':
|
case 'checked':
|
||||||
case 'selected':
|
case 'selected':
|
||||||
$selected = array_values((array)$_val);
|
$selected = array_map('strval', array_values((array)$_val));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'checkboxes':
|
case 'checkboxes':
|
||||||
@@ -122,7 +122,7 @@ function smarty_function_html_checkboxes_output($name, $value, $output, $selecte
|
|||||||
. smarty_function_escape_special_chars($name) . '[]" value="'
|
. smarty_function_escape_special_chars($name) . '[]" value="'
|
||||||
. smarty_function_escape_special_chars($value) . '"';
|
. smarty_function_escape_special_chars($value) . '"';
|
||||||
|
|
||||||
if (in_array($value, $selected, true)) {
|
if (in_array((string)$value, $selected)) {
|
||||||
$_output .= ' checked="checked"';
|
$_output .= ' checked="checked"';
|
||||||
}
|
}
|
||||||
$_output .= $extra . ' />' . $output;
|
$_output .= $extra . ' />' . $output;
|
||||||
|
@@ -48,11 +48,14 @@ function smarty_function_html_options($params, &$smarty)
|
|||||||
$$_key = (array)$_val;
|
$$_key = (array)$_val;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'selected':
|
|
||||||
case 'values':
|
case 'values':
|
||||||
case 'output':
|
case 'output':
|
||||||
$$_key = array_values((array)$_val);
|
$$_key = array_values((array)$_val);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'selected':
|
||||||
|
$$_key = array_map('strval', array_values((array)$_val));
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if(!is_array($_val)) {
|
if(!is_array($_val)) {
|
||||||
@@ -95,7 +98,7 @@ function smarty_function_html_options_optoutput($key, $value, $selected) {
|
|||||||
if(!is_array($value)) {
|
if(!is_array($value)) {
|
||||||
$_html_result = '<option label="' . smarty_function_escape_special_chars($value) . '" value="' .
|
$_html_result = '<option label="' . smarty_function_escape_special_chars($value) . '" value="' .
|
||||||
smarty_function_escape_special_chars($key) . '"';
|
smarty_function_escape_special_chars($key) . '"';
|
||||||
if (in_array($key, $selected, true))
|
if (in_array((string)$key, $selected))
|
||||||
$_html_result .= ' selected="selected"';
|
$_html_result .= ' selected="selected"';
|
||||||
$_html_result .= '>' . smarty_function_escape_special_chars($value) . '</option>' . "\n";
|
$_html_result .= '>' . smarty_function_escape_special_chars($value) . '</option>' . "\n";
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user