From 35e045286da0fc6898ddda3822260780addbba68 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Mon, 25 Nov 2019 10:09:01 +0000 Subject: [PATCH] Media: Avoid a PHP notice in `image_downsize()` when trying to replace a non-image URL with a rendered image from its meta. Props Mte90, jrf, hareesh-pillai. Merges [46772] to the 5.3 branch. Fixes #48324. Built from https://develop.svn.wordpress.org/branches/5.3@46773 git-svn-id: http://core.svn.wordpress.org/branches/5.3@46573 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/media.php | 2 +- wp-includes/version.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-includes/media.php b/wp-includes/media.php index 002581e174..3783865958 100644 --- a/wp-includes/media.php +++ b/wp-includes/media.php @@ -214,7 +214,7 @@ function image_downsize( $id, $size = 'medium' ) { // If the file isn't an image, attempt to replace its URL with a rendered image from its meta. // Otherwise, a non-image type could be returned. if ( ! $is_image ) { - if ( ! empty( $meta['sizes'] ) ) { + if ( ! empty( $meta['sizes']['full'] ) ) { $img_url = str_replace( $img_url_basename, $meta['sizes']['full']['file'], $img_url ); $img_url_basename = $meta['sizes']['full']['file']; $width = $meta['sizes']['full']['width']; diff --git a/wp-includes/version.php b/wp-includes/version.php index 960900aaf5..f5aa671dbc 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.3.1-alpha-46771'; +$wp_version = '5.3.1-alpha-46773'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.