Skip to content

Commit

Permalink
Merge pull request #28502 from staudenmeir/validation
Browse files Browse the repository at this point in the history
[5.8] Fix validation with multiple passes() calls
  • Loading branch information
taylorotwell committed May 13, 2019
2 parents 3391439 + 0e52e47 commit f5d37e4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Illuminate/Validation/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,8 @@ public function passes()

$this->distinctValues = [];

$this->failedRules = [];

// We'll spin through each rule, validating the attributes attached to that
// rule. Any error messages will be added to the containers with each of
// the other error messages, returning true if we don't have messages.
Expand Down
8 changes: 8 additions & 0 deletions tests/Validation/ValidationValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4413,6 +4413,14 @@ public function testValidatedNotValidateTwiceData()
$this->assertEquals(1, $validateCount);
}

public function testMultiplePassesCalls()
{
$trans = $this->getIlluminateArrayTranslator();
$v = new Validator($trans, [], ['foo' => 'string|required']);
$this->assertFalse($v->passes());
$this->assertFalse($v->passes());
}

/**
* @dataProvider validUuidList
*/
Expand Down

0 comments on commit f5d37e4

Please sign in to comment.