Skip to content

Commit

Permalink
Fix validation with multiple passes() calls
Browse files Browse the repository at this point in the history
  • Loading branch information
staudenmeir committed May 12, 2019
1 parent 3066bb1 commit 0e52e47
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 0e52e47

Please sign in to comment.