Make WordPress Core

Changeset 48956 for branches/5.5


Ignore:
Timestamp:
09/07/2020 01:05:15 PM (4 years ago)
Author:
SergeyBiryukov
Message:

Media: In wp_ajax_image_editor(), check if the error property exists before accessing it.

This avoids a PHP notice when editing an image.

Follow-up to [48375].

Props Mista-Flo.
Merges [48946] to the 5.5 branch.
Fixes #51251.

Location:
branches/5.5
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.5

  • branches/5.5/src/wp-admin/includes/ajax-actions.php

    r48589 r48956  
    26052605
    26062606    $msg = false;
     2607
    26072608    switch ( $_POST['do'] ) {
    26082609        case 'save':
    26092610            $msg = wp_save_image( $attachment_id );
    2610             if ( $msg->error ) {
     2611            if ( ! empty( $msg->error ) ) {
    26112612                wp_send_json_error( $msg );
    26122613            }
     
    26262627    $html = ob_get_clean();
    26272628
    2628     if ( $msg->error ) {
     2629    if ( ! empty( $msg->error ) ) {
    26292630        wp_send_json_error(
    26302631            array(
Note: See TracChangeset for help on using the changeset viewer.