Code hooking on `image_downsize` can no longer assume the file is an image
|Reported by:||stephdau||Owned by:||mikeschroder|
Description (last modified by stephdau)
In r38949, Core pretty drastically changed the expectations that any code hooking onto the image_downsize filter could make until then, potentially leading to issues for integrators.
We went from having the image_downsize() function immediately return false if a file wasn't an image, not getting to that filter application at all, to only setting a variable with the result of the wp_attachment_is_image( $id ) test and now applying the filter (not even passing said result, for that matter).
This was a pretty big safe assumption to take away from under integrators' feet.
Coupled to this, a wise integrator that might have picked up on this change could have wanted to have its own code have image_downsize() still returning false if it does not want to have the file further processed by the function, but there is no opportunity to, since returning false will cause image_downsize() to keep on with its processing instead of proceeding with return $out.
Returning anything but false or null will cause image_downsize() to return, but that might not always be desirable to preserve the way WP worked prior to 4.7.
What's better here for general use isn't as clear cut as what r38949 made it to be. I've discussed the case with @mikeschroder, and we've agreed to open this ticket so we can further discuss what should be done, if anything.