Skip to content

Commit 18ce341

Browse files
committed
General: Add support for unicode email addresses in sanitise_email
Related to #31992.
1 parent 7c49a5e commit 18ce341

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
@@ -3814,7 +3814,7 @@ function sanitize_email( $email ) {
38143814
* LOCAL PART
38153815
* Test for invalid characters.
38163816
*/
3817-
$local = preg_replace( '/[^a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.-]/', '', $local );
3817+
$local = preg_replace( '/[^a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.\x80-\xff-]/', '', $local );
38183818
if ( '' === $local ) {
38193819
/** This filter is documented in wp-includes/formatting.php */
38203820
return apply_filters( 'sanitize_email', '', $email, 'local_invalid_chars' );
@@ -3855,7 +3855,7 @@ function sanitize_email( $email ) {
38553855
$sub = trim( $sub, " \t\n\r\0\x0B-" );
38563856

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

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

0 commit comments

Comments
 (0)