Skip to content
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

Email addresses can contain unicode nowadays #23239

Closed
yeahfree opened this issue Feb 21, 2018 · 2 comments
Closed

Email addresses can contain unicode nowadays #23239

yeahfree opened this issue Feb 21, 2018 · 2 comments

Comments

@yeahfree
Copy link

yeahfree commented Feb 21, 2018

  • Laravel Version: 5.5.*
  • PHP Version: 7.1 and higher
  • Database Driver & Version: Not applicable

Description:

The email validation is slightly outdated. From PHP 7.1 and the fact that modern domain names can use various unicode nowadays (eg. http://müller.com/), the email validation ought to be updated. The email validation functionality can be found at /src/Illuminate/Validation/Concerns/ValidatesAttributes.php and the function is validateEmail(). Other relevant information can be found at:
https://secure.php.net/manual/en/filter.filters.validate.php (at the row with FILTER_VALIDATE_EMAIL)
http://php.net/manual/en/filter.constants.php (at the bottom at FILTER_FLAG_EMAIL_UNICODE)

Steps To Reproduce:

Creating a Validator with an email rule and then pass "test@müller.com" into it.


Thank you for your time, if you need any more information, please don't hesitate to ask. I tried implementing it quickly myself by adding the flag to the filter_var (, but that did not seem to do the trick so far :( I will in the meanwhile implement it for my project as a custom validation rule (see: https://laravel.com/docs/5.4/validation#custom-validation-rules )

@tillkruss
Copy link
Contributor

Could you post how you're using FILTER_FLAG_EMAIL_UNICODE?

@cwang22
Copy link
Contributor

cwang22 commented Mar 2, 2018

the documentation says its only for the local part

FILTER_FLAG_EMAIL_UNICODE (integer)
Accepts Unicode characters in the local part in "validate_email" filter. (Available as of PHP 7.1.0)

so simply passing it as a flag to filter_var will not work for test@müller.com

there's library support this like egulias/EmailValidator

This can be optional for user to choose if they want it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants