Media: Don't use 'full' as array key in `wp_calculate_image_srcset()`.

In `wp_calculate_image_srcset()` we get an array of image sizes
associated with an attachment and then add the original image's
information to the array before processing the `srcset`. In doing
so, we set the original data to a `$image_sizes['full']` key, which
could stomp on any custom image sizes using `full` as a size name.

This avoid the issues by adding the original data without a named
key, which is never referenced anyway.

Props jaspermdegroot.
Fixes #36345.
Built from https://develop.svn.wordpress.org/trunk@37986


git-svn-id: http://core.svn.wordpress.org/trunk@37927 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Joe McGill 2016-07-06 14:05:29 +00:00
parent 139387b7e5
commit 7e5885b874
2 changed files with 2 additions and 2 deletions

View File

@ -1008,7 +1008,7 @@ function wp_calculate_image_srcset( $size_array, $image_src, $image_meta, $attac
* If src is an intermediate size GIF, the full size is excluded from srcset to keep a flattened GIF from becoming animated. * If src is an intermediate size GIF, the full size is excluded from srcset to keep a flattened GIF from becoming animated.
*/ */
if ( ! isset( $image_sizes['thumbnail']['mime-type'] ) || 'image/gif' !== $image_sizes['thumbnail']['mime-type'] ) { if ( ! isset( $image_sizes['thumbnail']['mime-type'] ) || 'image/gif' !== $image_sizes['thumbnail']['mime-type'] ) {
$image_sizes['full'] = array( $image_sizes[] = array(
'width' => $image_meta['width'], 'width' => $image_meta['width'],
'height' => $image_meta['height'], 'height' => $image_meta['height'],
'file' => $image_basename, 'file' => $image_basename,

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.6-beta1-37985'; $wp_version = '4.6-beta1-37986';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.