Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/wp-includes/default-filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
die( '-1' );
}

global $wpdb;

// Strip, trim, kses, special chars for string saves.
foreach ( array( 'pre_term_name', 'pre_comment_author_name', 'pre_link_name', 'pre_link_target', 'pre_link_rel', 'pre_user_display_name', 'pre_user_first_name', 'pre_user_last_name', 'pre_user_nickname' ) as $filter ) {
add_filter( $filter, 'sanitize_text_field' );
Expand Down Expand Up @@ -272,6 +274,10 @@

// Email filters.
add_filter( 'wp_mail', 'wp_staticize_emoji_for_email' );
if ( is_utf8_charset() && 'utf8mb4' === $wpdb->charset ) {
add_filter( 'is_email', 'is_unicode_email', 8, 3 );
add_filter( 'sanitize_email', 'sanitize_unicode_email', 8, 3 );
}

// Robots filters.
add_filter( 'wp_robots', 'wp_robots_noindex' );
Expand Down
22 changes: 22 additions & 0 deletions src/wp-includes/formatting.php
Original file line number Diff line number Diff line change
Expand Up @@ -3624,6 +3624,28 @@
return apply_filters( 'is_email', $email, $email, null );
}

$u = new Uri\WhatWg\Url('blar');

Check failure on line 3627 in src/wp-includes/formatting.php

View workflow job for this annotation

GitHub Actions / Coding standards / PHP checks

Expected 1 spaces before closing parenthesis; 0 found

Check failure on line 3627 in src/wp-includes/formatting.php

View workflow job for this annotation

GitHub Actions / Coding standards / PHP checks

Expected 1 spaces after opening parenthesis; 0 found
$u->getAsciiHost()

function is_unicode_email_filter( $ignored_filtered_email, $originally_provided_email, $ignored_message ) {

Check warning on line 3630 in src/wp-includes/formatting.php

View workflow job for this annotation

GitHub Actions / PHP static analysis / Run PHP static analysis

Syntax error, unexpected T_FUNCTION on line 3630
remove_filter( 'is_email', 'is_unicode_email_filter' );
$result = is_unicode_email( $originally_provided_email );
add_filter( 'is_email', 'is_unicode_email_filter', 8, 3 );

return $result;
}

function is_unicode_email( $email ) {
$email = WP_Email_Address::from_string( $email );
if ( null === $email ) {
return apply_filters( 'is_email', false, $email, 'non_parsable_email' );
}

...

Check failure on line 3644 in src/wp-includes/formatting.php

View workflow job for this annotation

GitHub Actions / Coding standards / PHP checks

Expected 0 spaces after the spread operator; newline found

Check warning on line 3644 in src/wp-includes/formatting.php

View workflow job for this annotation

GitHub Actions / PHP static analysis / Run PHP static analysis

Syntax error, unexpected T_ELLIPSIS on line 3644

return apply_filters( 'is_email', $email, $email, null );
}

/**
* Converts to ASCII from email subjects.
*
Expand Down
Loading