From aa2ee3cd66abdcf22a2457259f3124c7f62f017e Mon Sep 17 00:00:00 2001 From: messju Date: Tue, 9 Dec 2003 19:38:25 +0000 Subject: [PATCH] fix bug when comparing array-keys to "selected" in html_options and html_checkboxes in_array() uses "strict" comparason now. --- NEWS | 2 ++ libs/plugins/function.html_checkboxes.php | 2 +- libs/plugins/function.html_options.php | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index d1f5a7c3..f32e8048 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,5 @@ + - fix bug when comparing array-keys to "selected" in html_options + and html_checkboxes (messju) - add better checks for correctly nested tags when compiling (messju) - remove {$SCRIPT_NAME}. use {$smarty.server.SCRIPT_NAME} instead (messju) - remove $global_assign. assign global variables explicitly instead (messju) diff --git a/libs/plugins/function.html_checkboxes.php b/libs/plugins/function.html_checkboxes.php index 2167282d..05fe63c0 100644 --- a/libs/plugins/function.html_checkboxes.php +++ b/libs/plugins/function.html_checkboxes.php @@ -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)) { + if (in_array($value, $selected, true)) { $_output .= ' checked="checked"'; } $_output .= $extra . ' />' . $output; diff --git a/libs/plugins/function.html_options.php b/libs/plugins/function.html_options.php index 2669b543..fab21753 100644 --- a/libs/plugins/function.html_options.php +++ b/libs/plugins/function.html_options.php @@ -95,7 +95,7 @@ function smarty_function_html_options_optoutput($key, $value, $selected) { if(!is_array($value)) { $_html_result = '