Make WordPress Core

Opened 17 months ago

Closed 17 months ago

Last modified 15 months ago

#51251 closed defect (bug) (fixed)

Fix PHP notice when opening the edit image popup

Reported by: Mista-Flo Owned by: 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 17 months ago.
Screenshot 2020-09-05 at 14.26.04.png (385.8 KB) - added by Mista-Flo 17 months ago.

Download all attachments as: .zip

Change History (11)

@Mista-Flo
17 months ago

#1 @Mista-Flo
17 months 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
17 months 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
17 months ago

  • Milestone changed from 5.6 to 5.5.2

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

#4 @Mista-Flo
17 months ago

  • Keywords needs-testing removed

Thank you Sergey, nice catch :)

#5 @SergeyBiryukov
17 months 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
17 months 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
17 months 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
16 months ago

  • Version set to 5.5

#9 @SergeyBiryukov
15 months ago

#51655 was marked as a duplicate.

Note: See TracTickets for help on using tickets.