Make WordPress Core

Opened 8 years ago

Last modified 7 years ago

#35201 new enhancement

Mobile email validation

Reported by: njbebop's profile njbebop Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.4
Component: Formatting Keywords:
Focuses: Cc:


While testing form submission through Samsung Android devices (Galaxy S6 Edge and Galaxy Note 5), we noticed that when user selects their email from the field history dropdown, it appends a space at the end of the email address. This invalidates the email when using the is_email validation function in wp-includes/formatting.php.

A fix I am currently using is simply adding a trim function to the email address in the first line of the function...

$email = trim($email);

This resolves the Samsung bug and passes the email validation. I hope this helps.

Attachments (1)

formatting.php (158.2 KB) - added by njbebop 8 years ago.
Updated formatting.php file

Download all attachments as: .zip

Change History (4)

8 years ago

Updated formatting.php file

#1 @johnbillion
8 years ago

  • Focuses accessibility removed
  • Keywords reporter-feedback added

Thanks for the report, @njbebop.

Can you let us know which form this problem appears on? Is it a custom form in a plugin/theme, or one of the forms in WordPress itself? Thanks!

#2 @njbebop
8 years ago

Hi John,

The form is a checkout form for WP E-Commerce plugin. However, tracing back the validation for the form, it uses the is_email function in formatting.php.

We don't use any other forms on our site, Wordpress or plugins. I coded all the contact forms on the site from scratch. I also had to address the same issue with my email validation javascript code. For some reason, the Samsung Galaxy series of phones append that pesky space at the end of the email address, and the regex space check doesn't like it.

If you need any other information, let me know.

John Hurley

#3 @swissspidy
7 years ago

  • Keywords reporter-feedback removed

It would be great if someone else could verify this using built-in forms in WordPress. In this case, it might be specific to the custom forms built by the developer.

Note: See TracTickets for help on using tickets.