hopefully last attempt to get correct handling of '0', 0 and '' (first should be treated equal, last not)

This commit is contained in:
Ralf Becker 2010-12-20 20:57:35 +00:00
parent 746d48d5af
commit 515e84b96c

View File

@ -412,7 +412,7 @@ class html
$selected = $not_selected = array(); $selected = $not_selected = array();
foreach($arr as $val => $label) foreach($arr as $val => $label)
{ {
if (in_array($val,$key,!$val)) if (in_array((string)$val,$key))
{ {
$selected[$val] = $label; $selected[$val] = $label;
} }
@ -439,7 +439,7 @@ class html
if (strlen($label) > $max_len) $max_len = strlen($label); if (strlen($label) > $max_len) $max_len = strlen($label);
$html .= self::label(self::checkbox($name,in_array($val,$key,!$val),$val,$options_no_id. $html .= self::label(self::checkbox($name,in_array((string)$val,$key),$val,$options_no_id.
' id="'.$base_name.'['.$val.']'.'"').self::htmlspecialchars($label), ' id="'.$base_name.'['.$val.']'.'"').self::htmlspecialchars($label),
$base_name.'['.$val.']','',($title ? 'title="'.self::htmlspecialchars($title).'" ':''))."<br />\n"; $base_name.'['.$val.']','',($title ? 'title="'.self::htmlspecialchars($title).'" ':''))."<br />\n";
} }