cvs: smarty /libs/plugins function.html_checkboxes.php function.html_options.php

"Messju Mohr" <[email protected]>
Newsgroups gmane.comp.php.cvs.smarty
Message-ID <cvsmessju1071000126@cvsserver>
messju		Tue Dec  9 15:02:06 2003 EDT

  Modified files:              
    /smarty/libs/plugins	function.html_checkboxes.php 
                        	function.html_options.php 
  Log:
  strict comparason didn't work in all cases. use type-casting now.
  
  
Index: smarty/libs/plugins/function.html_checkboxes.php
diff -u smarty/libs/plugins/function.html_checkboxes.php:1.12 smarty/libs/plugins/function.html_checkboxes.php:1.13
--- smarty/libs/plugins/function.html_checkboxes.php:1.12	Tue Dec  9 14:38:25 2003
+++ smarty/libs/plugins/function.html_checkboxes.php	Tue Dec  9 15:02:06 2003
@@ -73,7 +73,7 @@
 
             case 'checked':
             case 'selected':
-                $selected = array_values((array)$_val);
+                $selected = array_map('strval', array_values((array)$_val));
                 break;
 
             case 'checkboxes':
@@ -122,7 +122,7 @@
         . 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;
Index: smarty/libs/plugins/function.html_options.php
diff -u smarty/libs/plugins/function.html_options.php:1.20 smarty/libs/plugins/function.html_options.php:1.21
--- smarty/libs/plugins/function.html_options.php:1.20	Tue Dec  9 14:38:25 2003
+++ smarty/libs/plugins/function.html_options.php	Tue Dec  9 15:02:06 2003
@@ -48,11 +48,14 @@
                 $$_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 @@
     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 {

-- 
Smarty CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.