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-signup.php

    r47198 r47550  
    1010nocache_headers();
    1111
    12 if ( is_array( get_site_option( 'illegal_names' ) ) && isset( $_GET['new'] ) && in_array( $_GET['new'], get_site_option( 'illegal_names' ) ) ) {
     12if ( is_array( get_site_option( 'illegal_names' ) ) && isset( $_GET['new'] ) && in_array( $_GET['new'], get_site_option( 'illegal_names' ), true ) ) {
    1313    wp_redirect( network_home_url() );
    1414    die();
     
    170170
    171171            // Use US English if the default isn't available.
    172             if ( ! in_array( $lang, $languages ) ) {
     172            if ( ! in_array( $lang, $languages, true ) ) {
    173173                $lang = '';
    174174            }
     
    439439        $languages = signup_get_available_languages();
    440440
    441         if ( in_array( $_POST['WPLANG'], $languages ) ) {
     441        if ( in_array( $_POST['WPLANG'], $languages, true ) ) {
    442442            $language = wp_unslash( sanitize_text_field( $_POST['WPLANG'] ) );
    443443
     
    790790        $languages = signup_get_available_languages();
    791791
    792         if ( in_array( $_POST['WPLANG'], $languages ) ) {
     792        if ( in_array( $_POST['WPLANG'], $languages, true ) ) {
    793793            $language = wp_unslash( sanitize_text_field( $_POST['WPLANG'] ) );
    794794
Note: See TracChangeset for help on using the changeset viewer.