From 1d5d5b3e87c069367c743e60889f2930a2d6a91e Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Mon, 17 Feb 2020 03:24:07 +0000 Subject: [PATCH] REST API: Restore `wp-admin/includes/image.php` requirement in `WP_REST_Attachments_Controller::create_item()`. Although the file is already included via the `::insert_attachment()` method, this addresses an inconsistency and corrects a misleading comment. It also reduces the possibility of a future error in case `::insert_attachment()` is no longer called earlier in `::create_item()` at some point. Follow-up to [43850] and [44206]. Props luisrivera. Fixes #49449. Built from https://develop.svn.wordpress.org/trunk@47296 git-svn-id: http://core.svn.wordpress.org/trunk@47096 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- .../endpoints/class-wp-rest-attachments-controller.php | 3 ++- wp-includes/version.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php index 59cb3ed182..eba5fa1388 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php @@ -185,8 +185,9 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller { header( 'X-WP-Upload-Attachment-ID: ' . $attachment_id ); } - // Include media functions to get access to wp_generate_attachment_metadata(). + // Include media and image functions to get access to wp_generate_attachment_metadata(). require_once ABSPATH . 'wp-admin/includes/media.php'; + require_once ABSPATH . 'wp-admin/includes/image.php'; // Post-process the upload (create image sub-sizes, make PDF thumbnalis, etc.) and insert attachment meta. // At this point the server may run out of resources and post-processing of uploaded images may fail. diff --git a/wp-includes/version.php b/wp-includes/version.php index 25f9cfaaea..0144386ced 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.4-beta1-47295'; +$wp_version = '5.4-beta1-47296'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.