-
-
Notifications
You must be signed in to change notification settings - Fork 42
EmailValidator with IDN fails on hyphen #94
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
Conversation
mapeveri
commented
Nov 22, 2020
| Q | A |
|---|---|
| Is bugfix? | ✔️ |
| New feature? | ❌ |
| Breaks BC? | ❌ |
| Fixed issues | #2 |
|
It seems to break tests: https://github.com/yiisoft/validator/runs/1438130363 |
|
@samdark Yep, the problem is with this emails: I commeted the email with problems in the test. Any idea why this email passed the filter_var? Thanks |
|
@mapeveri seems that filter_var isn't suitable for the purpose: https://3v4l.org/4oslP |
|
filter_var is RFC 5321 and we need way stricter validation. |
|
@samdark What validation do you recommend? |
|
Regular expressions. Simplistic ones. |
|
@samdark thanks. I updated this PR :) |
src/Rule/Email.php
Outdated
| } | ||
|
|
||
| if ($this->enableIDN && $valid === false) { | ||
| $pattern = '/^([a-zA-Z0-9._%+-]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/'; |
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.
That could be moved to a customizable property same as other regex patterns.
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.
@samdark there is a private pattern regex, maybe a new property $patternIdnEmail as a private property, is ok?
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.
@samdark i upated the PR ;)
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.
@samdark is it ok?
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.
Yes.
|
Thank you! |
