Make WordPress Core

Changeset 42669 for branches/4.9


Ignore:
Timestamp:
02/07/2018 11:48:37 PM (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.
Merges [42639] to the 4.9 branch.
Fixes #43201.

Location:
branches/4.9
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.9

  • branches/4.9/src/wp-includes/media.php

    r42452 r42669  
    12041204
    12051205    // Only return a 'srcset' value if there is more than one source.
    1206     if ( ! $src_matched || count( $sources ) < 2 ) {
     1206    if ( ! $src_matched || ! is_array( $sources ) || count( $sources ) < 2 ) {
    12071207        return false;
    12081208    }
Note: See TracChangeset for help on using the changeset viewer.