Skip to content

Commit eadef0b

Browse files
committed
General: Add support for unicode email addresses in sanitise_email
Related to #31992.
1 parent 8107825 commit eadef0b

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/wp-includes/formatting.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3795,7 +3795,7 @@ function sanitize_email( $email ) {
37953795
* LOCAL PART
37963796
* Test for invalid characters.
37973797
*/
3798-
$local = preg_replace( '/[^a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.-]/', '', $local );
3798+
$local = preg_replace( '/[^a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.\x80-\xff-]/', '', $local );
37993799
if ( '' === $local ) {
38003800
/** This filter is documented in wp-includes/formatting.php */
38013801
return apply_filters( 'sanitize_email', '', $email, 'local_invalid_chars' );
@@ -3836,7 +3836,7 @@ function sanitize_email( $email ) {
38363836
$sub = trim( $sub, " \t\n\r\0\x0B-" );
38373837

38383838
// Test for invalid characters.
3839-
$sub = preg_replace( '/[^a-z0-9-]+/i', '', $sub );
3839+
$sub = preg_replace( '/[^a-z0-9\x80-\xff-]+/i', '', $sub );
38403840

38413841
// If there's anything left, add it to the valid subs.
38423842
if ( '' !== $sub ) {

0 commit comments

Comments
 (0)