Skip to content

Commit

Permalink
reapplying fix for validators that we lost
Browse files Browse the repository at this point in the history
  • Loading branch information
niden committed Jul 9, 2024
1 parent 5e36c86 commit 2232467
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions phalcon/Filter/Validation/Validator/StringLength/Max.zep
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class Max extends AbstractValidator
*/
public function validate(<Validation> validation, var field) -> bool
{
var value, length, maximum, replacePairs, included, result;
var failed, included, length, maximum, replacePairs, value;

let value = validation->getValue(field);
if this->allowEmpty(field, value) {
Expand Down Expand Up @@ -115,12 +115,12 @@ class Max extends AbstractValidator
}

if included {
let result = length >= maximum;
let failed = length > maximum;
} else {
let result = length > maximum;
let failed = length >= maximum;
}

if result {
if failed {
let replacePairs = [
":max" : maximum
];
Expand Down
8 changes: 4 additions & 4 deletions phalcon/Filter/Validation/Validator/StringLength/Min.zep
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class Min extends AbstractValidator
*/
public function validate(<Validation> validation, var field) -> bool
{
var value, length, minimum, replacePairs, included, result;
var failed, included, length, minimum, replacePairs, value;

let value = validation->getValue(field);
if this->allowEmpty(field, value) {
Expand Down Expand Up @@ -115,12 +115,12 @@ class Min extends AbstractValidator
}

if included {
let result = length <= minimum;
let failed = length < minimum;
} else {
let result = length < minimum;
let failed = length <= minimum;
}

if result {
if failed {
let replacePairs = [
":min" : minimum
];
Expand Down

0 comments on commit 2232467

Please sign in to comment.