Make WordPress Core


Ignore:
Timestamp:
04/05/2020 03:00:44 AM (5 years ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Use strict type check for in_array() and array_search() where strings are involved.

This reduces the number of WordPress.PHP.StrictInArray.MissingTrueStrict issues from 486 to 50.

Includes minor code layout fixes for better readability.

See #49542.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/network/site-settings.php

    r47219 r47550  
    4444        $key = wp_unslash( $key );
    4545        $val = wp_unslash( $val );
    46         if ( 0 === $key || is_array( $val ) || in_array( $key, $skip_options ) ) {
     46        if ( 0 === $key || is_array( $val ) || in_array( $key, $skip_options, true ) ) {
    4747            continue; // Avoids "0 is a protected WP option and may not be modified" error when edit blog options.
    4848        }
     
    150150                <tr class="form-field">
    151151                    <th scope="row"><label for="<?php echo esc_attr( $option->option_name ); ?>"><?php echo esc_html( ucwords( str_replace( '_', ' ', $option->option_name ) ) ); ?></label></th>
    152                     <?php if ( $is_main_site && in_array( $option->option_name, array( 'siteurl', 'home' ) ) ) { ?>
     152                    <?php if ( $is_main_site && in_array( $option->option_name, array( 'siteurl', 'home' ), true ) ) { ?>
    153153                    <td><code><?php echo esc_html( $option->option_value ); ?></code></td>
    154154                    <?php } else { ?>
Note: See TracChangeset for help on using the changeset viewer.