Skip to content

Commit e3e134a

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

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
@@ -3785,7 +3785,7 @@ function sanitize_email( $email ) {
37853785
* LOCAL PART
37863786
* Test for invalid characters.
37873787
*/
3788-
$local = preg_replace( '/[^a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.-]/', '', $local );
3788+
$local = preg_replace( '/[^a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.\x80-\xff-]/', '', $local );
37893789
if ( '' === $local ) {
37903790
/** This filter is documented in wp-includes/formatting.php */
37913791
return apply_filters( 'sanitize_email', '', $email, 'local_invalid_chars' );
@@ -3826,7 +3826,7 @@ function sanitize_email( $email ) {
38263826
$sub = trim( $sub, " \t\n\r\0\x0B-" );
38273827

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

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

0 commit comments

Comments
 (0)