diff options
author | Sergey Biryukov <sergeybiryukov@git.wordpress.org> | 2020-09-05 18:10:47 +0000 |
---|---|---|
committer | Sergey Biryukov <sergeybiryukov@git.wordpress.org> | 2020-09-05 18:10:47 +0000 |
commit | 1c1a7b83650181fb11d6925aeac6c0482020f865 (patch) | |
tree | 9bfe1a5e4a3fc0d55480553af4ab0de60cb5cf6e | |
parent | 88ec90d6dfa31154f50a0246265f30adec09f67a (diff) | |
download | wordpress-1c1a7b83650181fb11d6925aeac6c0482020f865.tar.gz wordpress-1c1a7b83650181fb11d6925aeac6c0482020f865.zip |
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.
Fixes #51251.
git-svn-id: https://develop.svn.wordpress.org/trunk@48946 602fd350-edb4-49c9-b593-d223f7449a82
-rw-r--r-- | src/wp-admin/includes/ajax-actions.php | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/wp-admin/includes/ajax-actions.php b/src/wp-admin/includes/ajax-actions.php index 85996d2676..09fa49cb94 100644 --- a/src/wp-admin/includes/ajax-actions.php +++ b/src/wp-admin/includes/ajax-actions.php @@ -2604,10 +2604,11 @@ function wp_ajax_image_editor() { include_once ABSPATH . 'wp-admin/includes/image-edit.php'; $msg = false; + switch ( $_POST['do'] ) { case 'save': $msg = wp_save_image( $attachment_id ); - if ( $msg->error ) { + if ( ! empty( $msg->error ) ) { wp_send_json_error( $msg ); } @@ -2625,7 +2626,7 @@ function wp_ajax_image_editor() { wp_image_editor( $attachment_id, $msg ); $html = ob_get_clean(); - if ( $msg->error ) { + if ( ! empty( $msg->error ) ) { wp_send_json_error( array( 'message' => $msg, |