From 641e372432513df0d2ecd072d8aebdd0482d53ea Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Sat, 17 Oct 2015 22:11:28 +0000 Subject: [PATCH] Media: in `wp_get_attachment_image_sizes()`, ensure that `$img_width` exists when the image does not. Props kraftbj. See #33641. git-svn-id: https://develop.svn.wordpress.org/trunk@35250 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/media.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/media.php b/src/wp-includes/media.php index e693ba6be6..83f7f0726b 100644 --- a/src/wp-includes/media.php +++ b/src/wp-includes/media.php @@ -1003,12 +1003,12 @@ function wp_get_attachment_image_srcset( $attachment_id, $size = 'medium' ) { * @return string|bool A valid source size value for use in a 'sizes' attribute or false. */ function wp_get_attachment_image_sizes( $attachment_id, $size = 'medium', $args = null ) { - + $img_width = 0; // Try to get the image width from $args. if ( is_array( $args ) && ! empty( $args['width'] ) ) { $img_width = (int) $args['width']; } elseif ( $img = image_get_intermediate_size( $attachment_id, $size ) ) { - list( $img_width, $img_height ) = image_constrain_size_for_editor( $img['width'], $img['height'], $size ); + list( $img_width ) = image_constrain_size_for_editor( $img['width'], $img['height'], $size ); } // Bail early if $image_width isn't set.