HttpInput: Exception if the type is not known,
This commit is contained in:
parent
1093894187
commit
944a83e3bb
1 changed files with 13 additions and 8 deletions
|
|
@ -48,27 +48,32 @@ class HttpInput
|
|||
if ($p_type=="string")
|
||||
return;
|
||||
// Check if number
|
||||
else if ($p_type=="number"&&isNumber($this->array[$p_name])==0 )
|
||||
else if ($p_type=="number")
|
||||
{
|
||||
if ( isNumber($this->array[$p_name])==0 )
|
||||
{
|
||||
throw new Exception(_("Type invalide")."[ $p_name ] = {$this->array[$p_name]}"
|
||||
, EXC_PARAM_TYPE);
|
||||
}
|
||||
$this->array[$p_name]=h($this->array[$p_name]);
|
||||
throw new Exception(_("Type invalide")."[ $p_name ] = {$this->array[$p_name]}"
|
||||
, EXC_PARAM_TYPE);
|
||||
}
|
||||
// Check if date dd.mm.yyyy
|
||||
else if ($p_type=="date")
|
||||
{
|
||||
if (isDate($this->array[$p_name]) <> $this->array[$p_name])
|
||||
{
|
||||
$this->array[$p_name]=h($this->array[$p_name]);
|
||||
throw new Exception(_("Type invalide")."[ $p_name ] = {$this->array[$p_name]}"
|
||||
, EXC_PARAM_TYPE);
|
||||
}
|
||||
}
|
||||
else if ($p_type=="array"&&!is_array($this->array[$p_name]))
|
||||
{
|
||||
$this->array[$p_name]=h($this->array[$p_name]);
|
||||
throw new Exception(_("Type invalide")."[ $p_name ] = {$this->array[$p_name]}"
|
||||
}
|
||||
else if ($p_type=="array")
|
||||
{
|
||||
if (!is_array($this->array[$p_name]) ) {
|
||||
throw new Exception(_("Type invalide")."[ $p_name ] = {$this->array[$p_name]}"
|
||||
, EXC_PARAM_TYPE);
|
||||
}
|
||||
$this->array[$p_name]=h($this->array[$p_name]);
|
||||
}else {
|
||||
throw new Exception(_("Unknown type"));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue