Opened 3 years ago
Closed 3 years ago
#53130 closed defect (bug) (fixed)
is_email() and sanitize_email() differ.
Reported by: | DuisterDenHaag | Owned by: | desrosj |
---|---|---|---|
Milestone: | 5.8 | Priority: | normal |
Severity: | normal | Version: | 5.5 |
Component: | Formatting | Keywords: | commit |
Focuses: | Cc: |
Description (last modified by )
According to sanitize_email()
and FILTER_SANITIZE_EMAIL
and FILTER_VALIDATE_EMAIL
a plus sign (+) is a valid character in an email address. Yet is_email()
will fail. (info+admin@example.com
)
Why is the validity for is_email()
different from sanitize_email()
?
Before reporting this, I found two related issues: #47467 and [48645].
Since PHPMailer is using is_email() all valid addresses with a + will result in an error.
Attachments (1)
Change History (7)
#2
follow-up:
↓ 3
@
3 years ago
- Keywords needs-patch removed
#3
in reply to:
↑ 2
@
3 years ago
- Keywords close added
Replying to ayeshrajans:
is_email
function does accept email addresses with the plus sign.
var_dump(is_email('info+admin@example.com')); // info+admin@example.com
Just noting that I was able confirm, is_email()
does treat this address as valid.
#4
@
3 years ago
- Keywords commit added; close removed
- Milestone changed from Awaiting Review to 5.8
53130.diff adds a test for an email with a +
. I think it doesn't hurt to add to show it works (and continues to work).
is_email
function does accept email addresses with the plug sign.var_dump(is_email('info+admin@example.com')); // info+admin@example.com
Note the function returns the original email address on email addresses this function deems correct. If the
is_email
function returns false for you on such email address, it is possible that a plugin makes so by usingis_email
filter.