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

Improve Email::Valid validation #2

merged 1 commit into from Mar 13, 2017


None yet
2 participants

kyzn commented Mar 12, 2017

Hi Maros! Thanks for maintaining this great module.

While looking at the code, I found a use of Email::Valid where its return value was treated as a boolean. This is unfortunately a very common false assumption.

For example, if you call Email::Valid->address with an address that has spaces, it will trim spaces and return the address back to you, given that there is no other issues. This will be "true" if treated as boolean, but the address is still invalid. See Email::Valid#EXAMPLES for details.

I've tried to handle this case, and added a test case to make sure it fails properly.

Let me know if there's anything you want me to update.


Improve Email::Valid validation
Email::Valid->address can return some modified string of original email
which may cause some confusion if treated as a boolean value.
One example is where it strips spaces and returns it if there is no other issues.
I've tried to handle this case, with an additional test case to make sure it fails.

@maros maros self-assigned this Mar 13, 2017

@maros maros merged commit d45f2cf into maros:master Mar 13, 2017


This comment has been minimized.

Show comment
Hide comment

maros Mar 13, 2017


Thank you for your pull-request


maros commented Mar 13, 2017

Thank you for your pull-request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment