[wp-trac] [WordPress Trac] #26823: wp_get_image_editor->multi_resize()
WordPress Trac
noreply at wordpress.org
Tue Jan 14 02:51:50 UTC 2014
#26823: wp_get_image_editor->multi_resize()
--------------------------+------------------------------
Reporter: pbearne | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Inline Docs | Version: 3.5
Severity: normal | Resolution:
Keywords: has-patch |
--------------------------+------------------------------
Comment (by DH-Shredder):
Replying to [comment:4 alconebay]:
Ah, apologies. Indeed, you are correct on the `&&`s there being an issue.
The primary reason that check is there is to avoid warnings when we access
the array keys, rather than any sort of range checking.
The intended behaviour with `resize()` is to be able to pass `null` as one
of height or width (and this works).
As @markoheijnen explains, `image_resize_dimensions()` should handle
`null` just fine (because
[https://core.trac.wordpress.org/browser/trunk/src/wp-
includes/media.php#L325 null <= 0]), and as such, `resize()` does as well.
If there's an error in `image_resize_dimensions()`, it bubbles up.
However, right now, the signature of `multi_resize()` (and hence the check
mentioned) keeps you from taking advantage of this. I'd be up for
changing it to allow `null` on one of height or width, to bring it in line
with `resize()`'s behaviour.
If we do this, though, I'd prefer to see it simply pass `null` to
`resize()`, if the key is missing or `null` (and update docs to reflect
this), rather than any sort of `PHP_INT_MAX` trickery.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/26823#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list