Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#23884 closed defect (bug) (fixed)

Avoid notices when array arguments are missing in WP_Image_Editor::multi_resize()

Reported by: dh-shredder Owned by: nacin
Milestone: 3.6 Priority: normal
Severity: normal Version: 3.5
Component: Media Keywords: has-patch commit
Focuses: Cc:

Description

WP_Image_Editor::multi_resize accepts an array of arrays, where each can contain:
'height'=>int, 'width'=>int, 'crop'=>bool

At the moment, all of these are required, under penalty of notice.

In other parts of our code, 'crop' is expected to default to false and not be required.

The attached patch makes 'height' and 'width' required (skipping the resizes gracefully if they are not provided), and automatically sets crop to false if it's not provided.

Attachments (1)

23884.diff (3.1 KB) - added by dh-shredder 9 years ago.
edit: comment correction

Download all attachments as: .zip

Change History (4)

#1 @markoheijnen
9 years ago

  • Milestone changed from Awaiting Review to 3.6

@dh-shredder
9 years ago

edit: comment correction

#2 @SergeyBiryukov
9 years ago

  • Keywords commit added

#3 @nacin
9 years ago

  • Owner set to nacin
  • Resolution set to fixed
  • Status changed from new to closed

In 24055:

Image editors: multi_resize() should require height and width. Crop is now optional and defaults to false. props DH-Shredder. fixes #23884.

Note: See TracTickets for help on using tickets.