Opened 12 years ago
Last modified 6 years ago
#25108 new defect (bug)
is_email() function validates email with domain that just has 1 character after dot
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.6 |
Component: | Formatting | Keywords: | has-patch has-unit-tests is-email |
Focuses: | Cc: |
Description
is_email() function validates an email address that has domain name extension of just 1 character. I am not sure if there are any domains with just 1 character after.
To Test I used below code:
<?php if ( is_email( 'email@domain.c' ) ) { echo 'email address is valid.'; } ?>
Attachments (2)
Change History (8)
#4
@
12 years ago
- Keywords needs-unit-tests added
In 25108.diff, we can probably wait until after the loop is finished, then check $sub (which will hold the final piece) or do end( $subs )
.
Needs unit tests.
I think it's more than safe to exclude a one-letter TLD, yes.
#5
@
12 years ago
- Keywords has-unit-tests added; needs-unit-tests removed
25108.2.diff uses @nacin's suggested changes and adds (my first!) unit test.
Note: See
TracTickets for help on using
tickets.
This answer on Stack Overflow seems to indicate that in practice it's not valid, but it is valid in theory at least.