Make WordPress Core


Ignore:
Timestamp:
04/09/2020 03:41:04 PM (5 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/post.php

    r47550 r47557  
    549549
    550550            foreach ( $pages as $page ) {
    551                 if ( $page->ID == $parent ) {
    552                     $parent = $page->post_parent;
     551                if ( (int) $page->ID === $parent ) {
     552                    $parent = (int) $page->post_parent;
    553553                    break;
    554554                }
     
    569569
    570570        if ( ! isset( $post_type_object )
    571             || ( isset( $children ) && in_array( $post_ID, $children ) )
     571            || ( isset( $children ) && in_array( $post_ID, $children, true ) )
    572572            || ! current_user_can( 'edit_post', $post_ID )
    573573        ) {
Note: See TracChangeset for help on using the changeset viewer.