Make WordPress Core

Opened 2 years ago

Last modified 2 years ago

#54605 new defect (bug)

WP_Image_Editor_Imagick::resize is not behaving according to spec

Reported by: chillhoptom's profile chillhoptom Owned by:
Milestone: Awaiting Review Priority: normal
Severity: major Version: 3.5
Component: Media Keywords:
Focuses: Cc:

Description

According to docs, you should be able to pass int|null as either $max_w or $max_h

WP_Image_Editor_Imagick::resize( int|null $max_w, int|null $max_h, bool $crop = false )

Inside the function, $max_w and $max_h are directly passed to image_resize_dimensions

image_resize_dimensions( int $orig_w, int $orig_h, int $dest_w, int $dest_h, bool|array $crop = false )

This function does not accept int|null for either $dest_w or $dest_h and will return false, which causes WP_Image_Editor_Imagick::resize to return a WP_Error.

For example:

$editor->resize(1000,null);

will return a WP_Error while according to the documentation it should resize based on $max_w alone.

Change History (1)

#1 @hellofromTonya
2 years ago

  • Version changed from trunk to 3.5
Note: See TracTickets for help on using tickets.