Skip to content

Commit

Permalink
General: Add support for unicode email addresses in sanitise_email
Browse files Browse the repository at this point in the history
Related to #31992.
  • Loading branch information
arnt committed Nov 20, 2024
1 parent 4565b06 commit 1113c24
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/wp-includes/formatting.php
Original file line number Diff line number Diff line change
Expand Up @@ -3787,7 +3787,7 @@ function sanitize_email( $email ) {
* LOCAL PART
* Test for invalid characters.
*/
$local = preg_replace( '/[^a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.-]/', '', $local );
$local = preg_replace( '/[^a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.\x80-\xff-]/', '', $local );
if ( '' === $local ) {
/** This filter is documented in wp-includes/formatting.php */
return apply_filters( 'sanitize_email', '', $email, 'local_invalid_chars' );
Expand Down Expand Up @@ -3828,7 +3828,7 @@ function sanitize_email( $email ) {
$sub = trim( $sub, " \t\n\r\0\x0B-" );

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

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

0 comments on commit 1113c24

Please sign in to comment.