Make WordPress Core

Opened 5 years ago

Last modified 4 years ago

#48951 new feature request

email_too_short is not good email validation candidate

Reported by: dingo_d's profile dingo_d Owned by:
Milestone: Awaiting Review Priority: low
Severity: trivial Version: 5.4
Component: Mail Keywords: 2nd-opinion
Focuses: Cc:

Description

Currently, both is_email and sanitize_email will invalidate/sanitize valid emails:

'admin@mailserver1'
'm@m'

Both are valid emails. ICANN just discourages using them.

The problem comes when you work with decoupled WordPress, and the front end is using custom validation that allows such emails, but WordPress doesn't so you don't have consistent behavior. Plus this is just wrong, as the official specification allows such mails.

https://en.wikipedia.org/wiki/Email_address#Valid_email_addresses

Change History (2)

#1 @SergeyBiryukov
4 years ago

  • Component changed from Formatting to Mail

#2 @cbutlerjr
4 years ago

  • Priority changed from normal to low
  • Severity changed from normal to trivial
  • Type changed from defect (bug) to feature request

but WordPress doesn't so you don't have consistent behavior

WP runs filters in both is_email() and sanitize_email(). If necessary, you can run a filter on either of these so that if the $context is 'email_too_short', you return true instead.

Note: See TracTickets for help on using tickets.