Make WordPress Core


Ignore:
Timestamp:
07/11/2020 12:12:46 PM (5 years ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Use strict type check for in_array() in wp-includes/feed.php.

Additionally:

  • Correct inline comments per the documentation standards.
  • Correct the @ticket reference in tests/feed/atom.php.

Follow-up to [48429].

See #33591.

File:
1 edited

Legend:

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

    r48429 r48435  
    527527                $mimes = get_allowed_mime_types();
    528528
    529                 // Parse url
     529                // Parse URL.
    530530                if ( isset( $enclosure[0] ) && is_string( $enclosure[0] ) ) {
    531531                    $url = trim( $enclosure[0] );
    532532                }
    533533
    534                 // Parse length and type
    535                 foreach ( range( 1, 2 ) as $i ) {
     534                // Parse length and type.
     535                for ( $i = 1; $i <= 2; $i++ ) {
    536536                    if ( isset( $enclosure[ $i ] ) ) {
    537537                        if ( is_numeric( $enclosure[ $i ] ) ) {
    538538                            $length = trim( $enclosure[ $i ] );
    539                         } elseif ( in_array( $enclosure[ $i ], $mimes ) ) {
     539                        } elseif ( in_array( $enclosure[ $i ], $mimes, true ) ) {
    540540                            $type = trim( $enclosure[ $i ] );
    541541                        }
     
    549549                    esc_attr( $type )
    550550                );
     551
    551552                /**
    552553                 * Filters the atom enclosure HTML link tag for the current post.
Note: See TracChangeset for help on using the changeset viewer.