From a23fda87b34b78eb7248bf106ea2af1b356ccfdd Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Sat, 14 Mar 2009 01:35:47 +0000 Subject: [PATCH] Fix regex in sanitize_email(), props sambauers, see #9316 git-svn-id: https://develop.svn.wordpress.org/trunk@10783 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/formatting.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index 7603b8bea1..19d175ecab 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -1516,7 +1516,8 @@ function sanitize_email( $email ) { // LOCAL PART // Test for invalid characters - if ( !preg_match( '/^[a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.-]+$/', $local ) ) { + $local = preg_replace( '/[^a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.-]/', '', $local ); + if ( '' === $local ) { return apply_filters( 'sanitize_email', '', $email, 'local_invalid_chars' ); }