check type in Smarty plugin

This commit is contained in:
Etienne Roudeix
2013-06-24 12:31:47 +02:00
parent 06543bb68c
commit 00a8ad51b3
3 changed files with 36 additions and 82 deletions

View File

@@ -237,7 +237,15 @@ class TheliaLoop implements SmartyPluginInterface {
continue;
}
/* check default */
/* check type */
if($value !== null && !$argument->type->isValid($value)) {
$faultActor[] = $argument->name;
$faultDetails[] = sprintf('Invalid value for "%s" argument', $argument->name);
continue;
}
/* set default */
/* did it as last checking for we consider default value is acceptable no matter type or empty restriction */
if($value === null) {
$value = $argument->default;
}