Make WordPress Core

Changeset 42639


Ignore:
Timestamp:
02/02/2018 07:47:03 AM (7 years ago)
Author:
SergeyBiryukov
Message:

Media: Avoid a PHP warning in wp_calculate_image_srcset() if a plugin returns a non-array value via wp_calculate_image_srcset filter.

Props mrmadhat, codegrau.
Fixes #43201.

File:
1 edited

Legend:

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

    r42451 r42639  
    12061206
    12071207    // Only return a 'srcset' value if there is more than one source.
    1208     if ( ! $src_matched || count( $sources ) < 2 ) {
     1208    if ( ! $src_matched || ! is_array( $sources ) || count( $sources ) < 2 ) {
    12091209        return false;
    12101210    }
Note: See TracChangeset for help on using the changeset viewer.