Fix a parentheses issue that changes the logic and throw an error if $value['error'] is not set

This commit is contained in:
Flavio Copes
2015-12-10 19:19:28 +01:00
parent 53f097c2b3
commit e87505378d

View File

@@ -32,7 +32,7 @@ class Validation
}
// special case for files, value is never empty and errors with code 4 instead
if (empty($validate['required']) && $field['type'] == 'file' && (isset($value['error']) && ($value['error'] == UPLOAD_ERR_NO_FILE) || in_array(UPLOAD_ERR_NO_FILE, $value['error']))) {
if (empty($validate['required']) && $field['type'] == 'file' && (isset($value['error']) && ($value['error'] == UPLOAD_ERR_NO_FILE || in_array(UPLOAD_ERR_NO_FILE, $value['error'])))) {
return;
}
@@ -84,7 +84,7 @@ class Validation
}
// special case for files, value is never empty and errors with code 4 instead
if (empty($validate['required']) && $field['type'] == 'file' && (isset($value['error']) && ($value['error'] == UPLOAD_ERR_NO_FILE) || in_array(UPLOAD_ERR_NO_FILE, $value['error']))) {
if (empty($validate['required']) && $field['type'] == 'file' && (isset($value['error']) && ($value['error'] == UPLOAD_ERR_NO_FILE || in_array(UPLOAD_ERR_NO_FILE, $value['error'])))) {
return null;
}
@@ -620,7 +620,7 @@ class Validation
if (is_string($value)) {
$value = trim($value);
}
return (bool) $params !== true || !empty($value);
}