Skip to content

Commit

Permalink
bug #11739 [Validator] Pass strict argument into the strict email val…
Browse files Browse the repository at this point in the history
…idator (brianfreytag)

This PR was submitted for the master branch but it was merged into the 2.5 branch instead (closes #11739).

Discussion
----------

[Validator] Pass strict argument into the strict email validator

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #11722, #11719
| License       | MIT
| Doc PR        | none

When strict = true is set in the Email constraint, it loads up the third
party library to do strict validation, but it doesn't pass strict into
the library. Unless strict is passed into the library, only major e-mail
errors will be validated and e-mails like user@gmail ,com or
user@gmail,com will pass validation because they are registered as
warnings by the library and not errors.

/cc @egulias @stof

Commits
-------

d2a634d [Validator] Pass strict argument into the strict email validator
  • Loading branch information
fabpot committed Aug 27, 2014
2 parents f1611ab + d2a634d commit cf02d55
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion UPGRADE-2.5.md
Expand Up @@ -126,7 +126,7 @@ Validator
Also you have to add to your composer.json:

```
"egulias/email-validator": "1.1.*"
"egulias/email-validator": "~1.2"
```

* `ClassMetadata::getGroupSequence()` now returns `GroupSequence` instances
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -74,7 +74,7 @@
"propel/propel1": "1.6.*",
"ircmaxell/password-compat": "1.0.*",
"ocramius/proxy-manager": ">=0.3.1,<0.6-dev",
"egulias/email-validator": "1.1.0"
"egulias/email-validator": "~1.2"
},
"autoload": {
"psr-0": { "Symfony\\": "src/" },
Expand Down
Expand Up @@ -59,7 +59,7 @@ public function validate($value, Constraint $constraint)

if ($constraint->strict && class_exists('\Egulias\EmailValidator\EmailValidator')) {
$strictValidator = new StrictEmailValidator();
$valid = $strictValidator->isValid($value, false);
$valid = $strictValidator->isValid($value, false, true);
} elseif ($constraint->strict === true) {
throw new \RuntimeException('Strict email validation requires egulias/email-validator');
} else {
Expand Down

0 comments on commit cf02d55

Please sign in to comment.