8000 [Security] validate empty passwords again by xabbuh · Pull Request #23507 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[ 8000 Security] validate empty passwords again #23507

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
8000
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,29 @@ public function testPasswordIsNotValid()
->assertRaised();
}

/**
* @dataProvider emptyPasswordData
*/
public function testEmptyPasswordsAreNotValid($password)
{
$constraint = new UserPassword(array(
'message' => 'myMessage',
));

$this->validator->validate($password, $constraint);

$this->buildViolation('myMessage')
->assertRaised();
}

public function emptyPasswordData()
{
return array(
array(null),
array(''),
);
}

/**
* @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ public function validate($password, Constraint $constraint)
}

if (null === $password || '' === $password) {
$this->context->addViolation($constraint->message);

return;
}

Expand Down
0