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
[Validator] more strict e-mail validation regex #14853
Conversation
xabbuh
commented
Jun 3, 2015
Q | A |
---|---|
Bug fix? | yes |
New feature? | no |
BC breaks? | no |
Deprecations? | no |
Tests pass? | yes |
Fixed tickets | #14848 |
License | MIT |
Doc PR |
👍
|
You sure this is according to the standard? From what I read, the domain may be bracketed.
|
@@ -91,6 +91,7 @@ public function getInvalidEmails() | |||
array('example'), | |||
array('example@'), | |||
array('example@localhost'), | |||
array('foo@example.com bar'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
http://en.wikipedia.org/wiki/Email_address
admin@mailserver1 (local domain name with no TLD)
I'm not sure about the RFC, but it seems that the simple test should allow the localhost example.
Why not? But that should imo be considered a new feature and therefore be introduced in Symfony 2.8. |
Actually, @iltar is right about localhost being a valid domain-part. The HTML5 pattern would accept that. Does everybody agree with switching to that regular expression then? |
We had a very lengthy discussion about this a few months ago, changing anything in the current regex would be a BC break. |
@fabpot Do you mean even the change forbidding whitespaces in the domain part would be a BC break? |
Not necessarily. I just wanted to say that it would be very easy to break BC if we change the current regex we agree upon a while ago. |
I'd be -1 on making the current rx even more weak. i.e. removing the "contains dot" constraint. It has been fine for months. |
I didn't mean to remove the check for the period in the domain part. I meant that the HTML5 pattern that you suggested also addresses the issue @iltar raised. |
So, what do we do here now? |
I think this one is conservative enough to be merges asis |
👍 |
Thank you @xabbuh. |
This PR was merged into the 2.6 branch. Discussion ---------- [Validator] more strict e-mail validation regex | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #14848 | License | MIT | Doc PR | Commits ------- 6491033 [Validator] more strict e-mail validation regex