Make WordPress Core

Ticket #57840: wp_rest_attachments_controller-upload_from_data.diff

File wp_rest_attachments_controller-upload_from_data.diff, 824 bytes (added by costdev, 22 months ago)

The $data parameter in WP_REST_Attachments_Controller::upload_from_data() is passed and treated only as string, not array.

  • src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php

    diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php
    index cae96c2587..09eae58f23 100644
    a b class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller { 
    968968         *
    969969         * @since 4.7.0
    970970         *
    971          * @param array $data    Supplied file data.
    972          * @param array $headers HTTP headers from the request.
     971         * @param string $data    Supplied file data.
     972         * @param array  $headers HTTP headers from the request.
    973973         * @return array|WP_Error Data from wp_handle_sideload().
    974974         */
    975975        protected function upload_from_data( $data, $headers ) {