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.
Built from https://develop.svn.wordpress.org/trunk@39107


git-svn-id: http://core.svn.wordpress.org/trunk@39049 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Joe McGill 2016-11-03 02:23:29 +00:00
parent d544c6ddd0
commit 37318fe73f
2 changed files with 4 additions and 2 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],

View File

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