Email validation rejects top-level domains longer than 4 characters
Bug #1615280 reported by
Mahara User
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Mahara |
Fix Released
|
Medium
|
Aaron Wells | ||
15.04 |
Won't Fix
|
Medium
|
Aaron Wells | ||
15.10 |
Won't Fix
|
Medium
|
Aaron Wells | ||
16.04 |
Fix Released
|
Medium
|
Aaron Wells | ||
16.10 |
Fix Released
|
Medium
|
Aaron Wells |
Bug Description
This one has existed since 2006, but only become an issue with the opening up of TLDs over the past few years. (https:/
Currently the email validation in pieform limits the TLD to between 2-4 characters (see pieform_
That means people from .horse, for example, can't register. Changing the regex fixed my immediate problem, haven't tested how the other email validation points react. They use FILTER_
Changed in mahara: | |
milestone: | 16.10.0 → none |
Changed in mahara: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
Thanks for reporting this! I wasn't even aware that Mahara had code that was trying to validate email addresses via a simple regex like that. The code in question is pretty old, originally written in 2007 and last updated in 2009 (to allow a "+" sign in the alias part of the email address.)
Of course since then, the number of top-level domain names has exploded. There used to be only a few rare ones longer than four characters; now there are dozens: https:/ /en.wikipedia. org/wiki/ List_of_ Internet_ top-level_ domains# ICANN-era_ generic_ top-level_ domains.
I find a few issues mentioned with PHP's "FILTER_ VALIDATE_ EMAIL" option, specifically:
1. Requires a "." in the domain name, so it fails on eg "root@localhost"
2. Doesn't work with emails containing non-ASCII characters. You can convert the domain part to punycode first, but I'm not sure if that works for the alias part.
On the other hand, both of those bugs are present in the current implementation! So switching to FILTER_ VALIDATE_ EMAIL would at least be an improvement.