Responsive images: do not attempt to create srcset when the image meta is missing or corrupted.
Props overclokk, jaspermdegroot, joemcgill. Fixes #35480. Built from https://develop.svn.wordpress.org/trunk@37002 git-svn-id: http://core.svn.wordpress.org/trunk@36969 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
571cf91329
commit
effedfdff4
|
@ -985,7 +985,7 @@ function wp_calculate_image_srcset( $size_array, $image_src, $image_meta, $attac
|
|||
*/
|
||||
$image_meta = apply_filters( 'wp_calculate_image_srcset_meta', $image_meta, $size_array, $image_src, $attachment_id );
|
||||
|
||||
if ( empty( $image_meta['sizes'] ) ) {
|
||||
if ( empty( $image_meta['sizes'] ) || strlen( $image_meta['file'] ) < 4 ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1060,6 +1060,11 @@ function wp_calculate_image_srcset( $size_array, $image_src, $image_meta, $attac
|
|||
*/
|
||||
foreach ( $image_sizes as $image ) {
|
||||
|
||||
// Check if image meta isn't corrupted.
|
||||
if ( ! is_array( $image ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// If the file name is part of the `src`, we've confirmed a match.
|
||||
if ( ! $src_matched && false !== strpos( $image_src, $dirname . $image['file'] ) ) {
|
||||
$src_matched = true;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.5-beta3-37001';
|
||||
$wp_version = '4.5-beta3-37002';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue