8000 [Validator][Email] - Strict validation and soft dependency by egulias · Pull Request #9140 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Validator][Email] - Strict validation and soft dependency #9140

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

Closed
wants to merge 16 commits into from
Closed
Changes from 1 commit
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
Diff view
Prev Previous commit
Next Next commit
Deaults strict to false
  • Loading branch information
egulias committed Mar 20, 2014
commit 89ca7137845748e9860b7f14bcf294d82d1464a3
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class EmailValidator extends ConstraintValidator
*/
private $isStrict;

public function __construct($strict)
public function __construct($strict = false)
{
$this->isStrict = $strict;
}
Expand All @@ -49,11 +49,11 @@ public function validate($value, Constraint $constraint)
}

$value = (string) $value;
if ($constraint->strict === null) {
if (null === $constraint->strict) {
$constraint->strict = $this->isStrict;
}

if (true === $constraint->strict && class_exists('\Egulias\EmailValidator\EmailValidator')) {
if ($constraint->strict && class_exists('\Egulias\EmailValidator\EmailValidator')) {
$strictValidator = new StrictEmailValidator();
$valid = $strictValidator->isValid($value, $constraint->checkMX);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should probably disable MX checks here as it's going to be redone below anyway.

} elseif ($constraint->strict === true) {
Expand Down
0