[validation] Fix error on undefined optional numeric value
Providing no value for an optional numeric parameter results in error "Parameter *** is invalid!" This is caused by the validation function ignoring the 'required' attribute when loading and checking input parameters. This commit adds checks to determine whether the 'required' attri- bute is defined and active before returning the error message. References #570:
This commit is contained in:
parent
0284e9d488
commit
1b1ab6a66e
1 changed files with 1 additions and 1 deletions
|
@ -80,7 +80,7 @@ function validateData(&$data, $parameters){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(is_null($data[$name])) {
|
if(is_null($data[$name]) && isset($set[$name]['required']) && $set[$name]['required']) {
|
||||||
echo 'Parameter \'' . $name . '\' is invalid!' . PHP_EOL;
|
echo 'Parameter \'' . $name . '\' is invalid!' . PHP_EOL;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue