Make WordPress Core


Ignore:
Timestamp:
04/09/2020 03:41:04 PM (4 years ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Use strict type check for in_array() and array_search().

This addresses all the remaining WordPress.PHP.StrictInArray.MissingTrueStrict issues in core.

Includes minor code layout fixes for better readability.

Follow-up to [47550].

See #49542.

File:
1 edited

Legend:

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

    r47550 r47557  
    923923                        )
    924924                    );
     925
    925926                    if ( is_array( $blog_users ) && ! empty( $blog_users ) ) {
    926927                        $user_site      = "<a href='" . esc_url( get_home_url( $details->userblog_id ) ) . "'>{$details->blogname}</a>";
     
    928929                        $user_dropdown .= "<select name='blog[$user_id][$key]' id='reassign_user'>";
    929930                        $user_list      = '';
     931
    930932                        foreach ( $blog_users as $user ) {
    931                             if ( ! in_array( $user->ID, $allusers ) ) {
     933                            if ( ! in_array( (int) $user->ID, $allusers, true ) ) {
    932934                                $user_list .= "<option value='{$user->ID}'>{$user->user_login}</option>";
    933935                            }
    934936                        }
     937
    935938                        if ( '' == $user_list ) {
    936939                            $user_list = $admin_out;
    937940                        }
     941
    938942                        $user_dropdown .= $user_list;
    939943                        $user_dropdown .= "</select>\n";
Note: See TracChangeset for help on using the changeset viewer.