add appropriate warnings when passing array as extra parameter

This commit is contained in:
mohrt
2003-04-14 16:57:40 +00:00
parent 7221c8afee
commit 423c1a2eae
5 changed files with 43 additions and 25 deletions

View File

@@ -26,27 +26,31 @@ function smarty_function_html_options($params, &$smarty)
$extra = '';
foreach($params as $_key => $_val) {
switch($_key) {
case 'name':
$$_key = (string)$_val;
break;
foreach($params as $_key => $_val) {
switch($_key) {
case 'name':
$$_key = (string)$_val;
break;
case 'options':
$$_key = (array)$_val;
break;
case 'options':
$$_key = (array)$_val;
break;
case 'selected':
case 'values':
case 'output':
$$_key = array_values((array)$_val);
break;
case 'selected':
case 'values':
case 'output':
$$_key = array_values((array)$_val);
break;
default:
$extra .= ' '.$_key.'="'.smarty_function_escape_special_chars($_val).'"';
break;
}
}
default:
if(!is_array($_val)) {
$extra .= ' '.$_key.'="'.smarty_function_escape_special_chars($_val).'"';
} else {
$smarty->trigger_error("html_options: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
}
break;
}
}
if (!isset($options) && !isset($values))
return ''; /* raise error here? */