Opened 3 years ago
Last modified 18 months ago
#55821 new defect (bug)
`is_email()` does not follow PHP FILTER_VALIDATE_EMAIL rules, when an email has double period (..)
Reported by: | khokansardar | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 5.9.3 |
Component: | Formatting | Keywords: | has-testing-info has-patch has-unit-tests |
Focuses: | Cc: |
Description
If there has a typo in an email address like there has double period .. in an email address ( abc..def@… ). is_email()
function return valid email when we have use like -
is_email( 'abc..def@xyz.com' )
Where it should not return as valid email address. Which is working with PHP FILTER_VALIDATE_EMAIL
checking. When we are checking the same kind of email with below code it return boolean false
.
filter_var( 'abc..def@xyz.com', FILTER_VALIDATE_EMAIL )
Expected behaviour should be like this. When use is_email()
function it should respect like what PHP does.
Change History (6)
This ticket was mentioned in PR #4631 on WordPress/wordpress-develop by @lopo.
18 months ago
#6
- Keywords has-patch has-unit-tests added; needs-patch removed
Added a check for double periods on the local part of the email address (taking inspiration from the same check on the domain part) + added unit test cases for both the local and the domain part (which was missing).
Trac ticket: https://core.trac.wordpress.org/ticket/55821
Testing Instructions
These steps define how to reproduce the issue, and indicate the expected behavior.
Steps to Reproduce
</html>
https://snippi.com/s/8gji8lpemail address is valid
is displayedExpected Results
When testing a patch to validate it works as expected:
email address is not valid.
Additionaly
We could change the
abc..def@xyz.com
to other not valid emails and see the results.