Image driver resize null checks causing crop_resize to fail
clpetersonucf opened this issue · 3 comments
Appreciate you guys keeping the lights on, we've had great success running our application on FuelPHP 1.9 and PHP 8.
After performing a production update last week, we noticed that image resizing has begun to fail. It appears associated with the recent changes to the image driver's _resize
method, which converted null checks using ==
and !=
to is_null()
.
However, the _crop_size
method is explicitly referencing _resize
and passing 0
as width or height parameters instead of null
. This is resulting in _resize
throwing the "Width and height cannot both be null." exception, because none of the prior conditions are being met. Testing locally, the fix may be as simple as changing references to $this->_resize()
within _crop_resize
to use null
instead of 0
.
I agree that
$this->_resize($width, 0, true, false);
should be
$this->_resize($width, null, true, false);
as it indicates the absence of a value. Have you tested this, as I am in no position at the moment.
Or better, test it, create a PR, so you get all the glory 😄
With what testing I've been able to perform, replacing 0
s with null
s did indeed resolve it. PR is up: #2214
Brillant, thanks !