[wp-trac] [WordPress Trac] #47557: Sanitize Email Suggestion
WordPress Trac
noreply at wordpress.org
Tue Jun 18 15:19:58 UTC 2019
#47557: Sanitize Email Suggestion
-------------------------+-----------------------------
Reporter: dandersoncm | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Formatting | Version: 5.2.1
Severity: minor | Keywords:
Focuses: |
-------------------------+-----------------------------
I am using WooCommerce and I've noticed several customer emails come
through like...
{{{
example at example.com1234
example at example.com1234567812345678
}}}
It's mostly due to the email input being the last one before the credit
card step, but these emails are passing the validation and sanitization
that exists: is_email and sanitize_email.
I am doing something like the following to fix...
{{{#!php
<?php
public function clean_billing_email_address( $value ) {
return trim( preg_replace( '/\d*$/', '', $value ) );
}
add_filter( 'woocommerce_process_checkout_field_billing_email',
'clean_billing_email_address' );
}}}
You may consider adding something like this to the sanitize_email function
since no TLD ends with numbers anyways, at least at this point in time.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/47557>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list