mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 19:04: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 'selected':
|
||||
$selected = array_values((array)$_val);
|
||||
$selected = array_map('strval', array_values((array)$_val));
|
||||
break;
|
||||
|
||||
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($value) . '"';
|
||||
|
||||
if (in_array($value, $selected, true)) {
|
||||
if (in_array((string)$value, $selected)) {
|
||||
$_output .= ' checked="checked"';
|
||||
}
|
||||
$_output .= $extra . ' />' . $output;
|
||||
|
@@ -48,11 +48,14 @@ function smarty_function_html_options($params, &$smarty)
|
||||
$$_key = (array)$_val;
|
||||
break;
|
||||
|
||||
case 'selected':
|
||||
case 'values':
|
||||
case 'output':
|
||||
$$_key = array_values((array)$_val);
|
||||
break;
|
||||
|
||||
case 'selected':
|
||||
$$_key = array_map('strval', array_values((array)$_val));
|
||||
break;
|
||||
|
||||
default:
|
||||
if(!is_array($_val)) {
|
||||
@@ -95,7 +98,7 @@ function smarty_function_html_options_optoutput($key, $value, $selected) {
|
||||
if(!is_array($value)) {
|
||||
$_html_result = '<option label="' . smarty_function_escape_special_chars($value) . '" value="' .
|
||||
smarty_function_escape_special_chars($key) . '"';
|
||||
if (in_array($key, $selected, true))
|
||||
if (in_array((string)$key, $selected))
|
||||
$_html_result .= ' selected="selected"';
|
||||
$_html_result .= '>' . smarty_function_escape_special_chars($value) . '</option>' . "\n";
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user