From 37318fe73f1b32fae1c289738f6d8cc21c99c4f8 Mon Sep 17 00:00:00 2001 From: Joe McGill Date: Thu, 3 Nov 2016 02:23:29 +0000 Subject: [PATCH] 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 --- wp-includes/media.php | 4 +++- wp-includes/version.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/wp-includes/media.php b/wp-includes/media.php index ad733013af..a3a8088a15 100644 --- a/wp-includes/media.php +++ b/wp-includes/media.php @@ -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], diff --git a/wp-includes/version.php b/wp-includes/version.php index 6a4a87d7e9..55fc21ff35 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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.