Make WordPress Core

Changeset 58261


Ignore:
Timestamp:
05/30/2024 09:17:58 PM (6 months ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Use strict comparison in wp-includes/user.php.

Follow-up to [2895], [3481], [5627], mu:1581, mu:1612, [12603], [18504], [33771], [41653], [41654], [45708], [51399].

Props dhruvang21, aristath, poena, afercia, SergeyBiryukov.
Fixes #61315. See #60700.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/user.php

    r58172 r58261  
    11031103    $site_capabilities_key = $wpdb->base_prefix . $blog_id . '_capabilities';
    11041104
    1105     if ( isset( $keys[ $base_capabilities_key ] ) && 1 == $blog_id ) {
     1105    if ( isset( $keys[ $base_capabilities_key ] ) && 1 === $blog_id ) {
    11061106        return true;
    11071107    }
     
    12541254
    12551255    if ( 'time' === $strategy ) {
    1256         if ( is_multisite() && get_current_blog_id() != $site_id ) {
     1256        if ( is_multisite() && get_current_blog_id() !== $site_id ) {
    12571257            switch_to_blog( $site_id );
    12581258            $avail_roles = wp_roles()->get_names();
     
    20142014function validate_username( $username ) {
    20152015    $sanitized = sanitize_user( $username, true );
    2016     $valid     = ( $sanitized == $username && ! empty( $sanitized ) );
     2016    $valid     = ( $sanitized === $username && ! empty( $sanitized ) );
    20172017
    20182018    /**
     
    24912491        do_action( 'profile_update', $user_id, $old_user_data, $userdata );
    24922492
    2493         if ( isset( $userdata['spam'] ) && $userdata['spam'] != $old_user_data->spam ) {
    2494             if ( 1 == $userdata['spam'] ) {
     2493        if ( isset( $userdata['spam'] ) && $userdata['spam'] !== $old_user_data->spam ) {
     2494            if ( '1' === $userdata['spam'] ) {
    24952495                /**
    24962496                 * Fires after the user is marked as a SPAM user.
     
    27492749    // Update the cookies if the password changed.
    27502750    $current_user = wp_get_current_user();
    2751     if ( $current_user->ID == $user_id ) {
     2751    if ( $current_user->ID === $user_id ) {
    27522752        if ( isset( $plaintext_pass ) ) {
    27532753            wp_clear_auth_cookie();
     
    27602760            /** This filter is documented in wp-includes/pluggable.php */
    27612761            $default_cookie_life = apply_filters( 'auth_cookie_expiration', ( 2 * DAY_IN_SECONDS ), $user_id, false );
    2762             $remember            = false;
     2762
     2763            $remember = false;
     2764
    27632765            if ( false !== $logged_in_cookie && ( $logged_in_cookie['expiration'] - time() ) > $default_cookie_life ) {
    27642766                $remember = true;
     
    35643566    $prefix = $wpdb->get_blog_prefix( $site_id );
    35653567
    3566     if ( is_multisite() && get_current_blog_id() != $site_id ) {
     3568    if ( is_multisite() && get_current_blog_id() !== $site_id ) {
    35673569        switch_to_blog( $site_id );
    35683570        $role_names = wp_roles()->get_names();
     
    36733675    }
    36743676
    3675     if ( $current_user->ID != $_POST['user_id'] ) {
     3677    if ( $current_user->ID !== (int) $_POST['user_id'] ) {
    36763678        return false;
    36773679    }
    36783680
    3679     if ( $current_user->user_email != $_POST['email'] ) {
     3681    if ( $current_user->user_email !== $_POST['email'] ) {
    36803682        if ( ! is_email( $_POST['email'] ) ) {
    36813683            $errors->add(
Note: See TracChangeset for help on using the changeset viewer.