When using phpThumb with only one url dimension parameter, i.e. "?src=x&h=300&hash=x" the following PHP 8 Error is thrown:
Fatal error: Uncaught TypeError: round(): Argument #1 ($num) must be of type int|float, string given in PATH\vendor\james-heinrich\phpthumb\phpthumb.class.php:1922
The issue occurs when only "height" OR "width" is set.
I nailed it down to the code a few lines above on line 1910 and 1911:
As $this->w is originally FALSE when not set, this line sets it to an empty string which now breaks round() on line 1922.
The issue can be fixed when the above code lines are populating $this->w / $this->h with NULL instead of empty string as NULL is an acceptable arg for round(). But I don't know why the code lines are setting to empty string in the first place instead of NULL.
Is it safe to change this in an PR to NULL?
When using phpThumb with only one url dimension parameter, i.e. "?src=x&h=300&hash=x" the following PHP 8 Error is thrown:
Fatal error: Uncaught TypeError: round(): Argument #1 ($num) must be of type int|float, string given in PATH\vendor\james-heinrich\phpthumb\phpthumb.class.php:1922
The issue occurs when only "height" OR "width" is set. I nailed it down to the code a few lines above on line 1910 and 1911:
As
$this->w
is originally FALSE when not set, this line sets it to an empty string which now breaks round() on line 1922.The issue can be fixed when the above code lines are populating
$this->w / $this->h
with NULL instead of empty string as NULL is an acceptable arg for round(). But I don't know why the code lines are setting to empty string in the first place instead of NULL. Is it safe to change this in an PR to NULL?