WordPress.org

Make WordPress Core

Ticket #52976: 52976.diff

File 52976.diff, 6.6 KB (added by paaggeli, 7 months ago)

case-insensitive email comparison using strcasecmp() function

  • src/wp-admin/_index.php

    diff --git a/src/wp-admin/_index.php b/src/wp-admin/_index.php
    index 6c704cc2fe..124d10a6dc 100644
    a b if ( has_action( 'welcome_panel' ) && current_user_can( 'edit_theme_options' ) ) 
    153153
    154154        $option = (int) get_user_meta( get_current_user_id(), 'show_welcome_panel', true );
    155155        // 0 = hide, 1 = toggled to show or single site creator, 2 = multisite site owner.
    156         $hide = ( 0 === $option || ( 2 === $option && wp_get_current_user()->user_email !== get_option( 'admin_email' ) ) );
     156        $hide = ( 0 === $option || ( 2 === $option && 0 !== strcasecmp( wp_get_current_user()->user_email, get_option( 'admin_email' ) ) ) );
    157157        if ( $hide ) {
    158158                $classes .= ' hidden';
    159159        }
  • src/wp-admin/includes/class-wp-automatic-updater.php

    diff --git a/src/wp-admin/includes/class-wp-automatic-updater.php b/src/wp-admin/includes/class-wp-automatic-updater.php
    index 641db4b325..b260ef8a35 100644
    a b class WP_Automatic_Updater { 
    257257
    258258                // Don't notify if we've already notified the same email address of the same version.
    259259                if ( $notified
    260                         && get_site_option( 'admin_email' ) === $notified['email']
     260                        && 0 === strcasecmp( get_site_option( 'admin_email' ), $notified['email'] )
    261261                        && $notified['version'] === $item->current
    262262                ) {
    263263                        return false;
    class WP_Automatic_Updater { 
    634634                // Don't notify if we've already notified the same email address of the same version of the same notification type.
    635635                if ( $notified
    636636                        && 'fail' === $notified['type']
    637                         && get_site_option( 'admin_email' ) === $notified['email']
     637                        && 0 === strcasecmp( get_site_option( 'admin_email' ), $notified['email'] )
    638638                        && $notified['version'] === $core_update->current
    639639                ) {
    640640                        $send = false;
  • src/wp-admin/includes/class-wp-screen.php

    diff --git a/src/wp-admin/includes/class-wp-screen.php b/src/wp-admin/includes/class-wp-screen.php
    index 57fb4f4038..25edba4554 100644
    a b final class WP_Screen { 
    11281128                                update_user_meta( get_current_user_id(), 'show_welcome_panel', $welcome_checked );
    11291129                        } else {
    11301130                                $welcome_checked = (int) get_user_meta( get_current_user_id(), 'show_welcome_panel', true );
    1131                                 if ( 2 === $welcome_checked && wp_get_current_user()->user_email !== get_option( 'admin_email' ) ) {
     1131                                if ( 2 === $welcome_checked && 0 !== strcasecmp( wp_get_current_user()->user_email, get_option( 'admin_email' ) ) ) {
    11321132                                        $welcome_checked = false;
    11331133                                }
    11341134                        }
  • src/wp-admin/includes/misc.php

    diff --git a/src/wp-admin/includes/misc.php b/src/wp-admin/includes/misc.php
    index 61d7698310..175bc29501 100644
    a b function wp_page_reload_on_back_button_js() { 
    13401340 * @param string $value     The proposed new site admin email address.
    13411341 */
    13421342function update_option_new_admin_email( $old_value, $value ) {
    1343         if ( get_option( 'admin_email' ) === $value || ! is_email( $value ) ) {
     1343        if ( 0 === strcasecmp( get_option( 'admin_email' ), $value ) || ! is_email( $value ) ) {
    13441344                return;
    13451345        }
    13461346
  • src/wp-admin/network/settings.php

    diff --git a/src/wp-admin/network/settings.php b/src/wp-admin/network/settings.php
    index edbac81b2e..68f9e8e97f 100644
    a b if ( isset( $_GET['updated'] ) ) { 
    165165                                        </p>
    166166                                        <?php
    167167                                        $new_admin_email = get_site_option( 'new_admin_email' );
    168                                         if ( $new_admin_email && get_site_option( 'admin_email' ) !== $new_admin_email ) :
     168                                        if ( $new_admin_email && 0 !== strcasecmp( get_site_option( 'admin_email' ), $new_admin_email ) ) :
    169169                                                ?>
    170170                                                <div class="updated inline">
    171171                                                <p>
  • src/wp-admin/options-general.php

    diff --git a/src/wp-admin/options-general.php b/src/wp-admin/options-general.php
    index aad04ced9b..b4dc60a85f 100644
    a b if ( ! is_multisite() ) { 
    113113<p class="description" id="new-admin-email-description"><?php _e( 'This address is used for admin purposes. If you change this, we will send you an email at your new address to confirm it. <strong>The new address will not become active until confirmed.</strong>' ); ?></p>
    114114<?php
    115115$new_admin_email = get_option( 'new_admin_email' );
    116 if ( $new_admin_email && get_option( 'admin_email' ) !== $new_admin_email ) :
     116if ( $new_admin_email && 0 !== strcasecmp( get_option( 'admin_email' ), $new_admin_email ) ) :
    117117        ?>
    118118        <div class="updated inline">
    119119        <p>
  • src/wp-admin/user-edit.php

    diff --git a/src/wp-admin/user-edit.php b/src/wp-admin/user-edit.php
    index acac0c4c29..22de4c476c 100644
    a b endif; 
    515515                endif;
    516516
    517517                $new_email = get_user_meta( $current_user->ID, '_new_email', true );
    518                 if ( $new_email && $new_email['newemail'] != $current_user->user_email && $profileuser->ID == $current_user->ID ) :
     518                if ( $new_email && 0 !== strcasecmp( $new_email['newemail'], $current_user->user_email ) && $profileuser->ID == $current_user->ID ) :
    519519                        ?>
    520520                <div class="updated inline">
    521521                <p>
  • src/wp-includes/ms-functions.php

    diff --git a/src/wp-includes/ms-functions.php b/src/wp-includes/ms-functions.php
    index 3364f25c28..5e0d414a2b 100644
    a b function get_subdirectory_reserved_names() { 
    28082808 * @param string $value     The proposed new network admin email address.
    28092809 */
    28102810function update_network_option_new_admin_email( $old_value, $value ) {
    2811         if ( get_site_option( 'admin_email' ) === $value || ! is_email( $value ) ) {
     2811        if ( 0 === strcasecmp( get_site_option( 'admin_email' ), $value ) || ! is_email( $value ) ) {
    28122812                return;
    28132813        }
    28142814
  • src/wp-includes/user.php

    diff --git a/src/wp-includes/user.php b/src/wp-includes/user.php
    index 048bb4c511..0876aa085d 100644
    a b function wp_insert_user( $userdata ) { 
    20172017        }
    20182018
    20192019        if ( $update ) {
    2020                 if ( $user_email !== $old_user_data->user_email || $user_pass !== $old_user_data->user_pass ) {
     2020                if ( 0 !== strcasecmp( $user_email, $old_user_data->user_email ) || $user_pass !== $old_user_data->user_pass ) {
    20212021                        $data['user_activation_key'] = '';
    20222022                }
    20232023                $wpdb->update( $wpdb->users, $data, compact( 'ID' ) );
    function wp_update_user( $userdata ) { 
    21872187                $send_password_change_email = apply_filters( 'send_password_change_email', true, $user, $userdata );
    21882188        }
    21892189
    2190         if ( isset( $userdata['user_email'] ) && $user['user_email'] !== $userdata['user_email'] ) {
     2190        if ( isset( $userdata['user_email'] ) && 0 !== strcasecmp( $user['user_email'], $userdata['user_email'] ) ) {
    21912191                /**
    21922192                 * Filters whether to send the email change email.
    21932193                 *