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 validation function _validateAddress now fails on new style tlds #30

Open
harrybailey opened this issue Feb 29, 2016 · 3 comments

Comments

@harrybailey
Copy link

Big fat warning for anyone still making use of this or considering using it.

The email validation function _validateAddress has a specific length check for the final part tld of the domain. It's limited to 6 characters.

Enter such domains as .academy (7 characters) and watch the invalid email exceptions fly.

@alphex
Copy link

alphex commented Jun 23, 2020

Well, 4 years later... does anyone have a solution to this?

@alphex
Copy link

alphex commented Jun 23, 2020

how good is anyones regex?

+[a-z]{2,6})|

in this line of code

		$regex = "/^([\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+\.)*[\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+@((((([a-z0-9]{1}[a-z0-9\-]{0,62}[a-z0-9]{1})|[a-z])\.)+[a-z]{2,6})|(\d{1,3}\.){3}\d{1,3}(\:\d{1,5})?)$/i";

Would that be the fix, changing the 6 to say? 20?

@Znarkus
Copy link
Owner

Znarkus commented Jun 23, 2020

Try to replace it with filter_var. If it works, PRs are welcome :)

https://www.php.net/manual/en/filter.examples.validation.php

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