Media: Sanity check array value in `wp_prepare_attachment_for_js()`.

This adds a sanity check to the return value of the `image_downsize` filter
in `wp_prepare_attachment_for_js()` to avoid undefined offest notices.

Props justinbusa for initial patch.
Fixes 34437.

git-svn-id: https://develop.svn.wordpress.org/trunk@39107 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Joe McGill 2016-11-03 02:22:43 +00:00
parent 7f67e60817
commit f2f3b3696b
1 changed files with 3 additions and 1 deletions

View File

@ -3159,8 +3159,10 @@ function wp_prepare_attachment_for_js( $attachment ) {
/** This filter is documented in wp-includes/media.php */
if ( $downsize = apply_filters( 'image_downsize', false, $attachment->ID, $size ) ) {
if ( ! $downsize[3] )
if ( empty( $downsize[3] ) ) {
continue;
}
$sizes[ $size ] = array(
'height' => $downsize[2],
'width' => $downsize[1],