mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX If RequiredFields::php() is given any fieldName that is NULL, don't attempt to validate a NULL field.
This commit is contained in:
parent
dbbabe129b
commit
d7a8fa9266
@ -66,6 +66,8 @@ class RequiredFields extends Validator {
|
||||
}
|
||||
if($this->required) {
|
||||
foreach($this->required as $fieldName) {
|
||||
if(!$fieldName) continue;
|
||||
|
||||
$formField = $fields->dataFieldByName($fieldName);
|
||||
|
||||
$error = true;
|
||||
@ -74,8 +76,7 @@ class RequiredFields extends Validator {
|
||||
if(is_array($value)) {
|
||||
if ($formField instanceof FileField && isset($value['error']) && $value['error']) {
|
||||
$error = true;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$error = (count($value)) ? false : true;
|
||||
}
|
||||
} else {
|
||||
@ -96,7 +97,6 @@ class RequiredFields extends Validator {
|
||||
$valid = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $valid;
|
||||
|
Loading…
Reference in New Issue
Block a user