Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 3 years ago

#51251 closed defect (bug) (fixed)

Fix PHP notice when opening the edit image popup

Reported by: mista-flo's profile Mista-Flo Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 5.5.2 Priority: normal
Severity: normal Version: 5.5
Component: Media Keywords: has-patch has-screenshots commit fixed-major
Focuses: Cc:

Description

Hi there, I noticed a PHP notice on the last trunk version while playing with the media library.

Steps to reproduce:

  • Activate Query Monitor plugin
  • Open your web console
  • Go to upload.php page on the backend
  • Select grid mode
  • Click on an attachment image
  • Click on 'Edit image' button
  • An edit image popup loads, and you should see a PHP notice saying that $msg->error is undefined

Attachments (2)

51251.1.patch (459 bytes) - added by Mista-Flo 4 years ago.
Screenshot 2020-09-05 at 14.26.04.png (385.8 KB) - added by Mista-Flo 4 years ago.

Download all attachments as: .zip

Change History (11)

@Mista-Flo
4 years ago

#1 @Mista-Flo
4 years ago

  • Keywords has-screenshots needs-testing added

Can you please try to reproduce the issue? Just to be sure it's not something related to me, but when looking at the code, it seems better to check that errors property exist in error object, otherwise it can throw an error anyway.

#2 @SergeyBiryukov
4 years ago

  • Milestone changed from Awaiting Review to 5.6
  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing

Thanks for the report! I was able to reproduce the issue.

#3 @SergeyBiryukov
4 years ago

  • Milestone changed from 5.6 to 5.5.2

Appears to be a regression in [48375] / #47147.

#4 @Mista-Flo
4 years ago

  • Keywords needs-testing removed

Thank you Sergey, nice catch :)

#5 @SergeyBiryukov
4 years ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 48946:

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.

#6 @SergeyBiryukov
4 years ago

  • Keywords commit fixed-major added
  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopening for backporting to the 5.5 branch.

#7 @SergeyBiryukov
4 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 48956:

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.

#8 @SergeyBiryukov
4 years ago

  • Version set to 5.5

#9 @SergeyBiryukov
3 years ago

#51655 was marked as a duplicate.

Note: See TracTickets for help on using tickets.