Closed torvista closed 2 years ago
Was there no backtrace associated with those fatal errors?
I'm seeing a bunch of places where image widths and heights are calculated, thus creating that float
input. I'll continue review and see if this/these issues can be 'nipped in the bud'.
The underlying issue was the lack of casting in the image's width and height calculations. Starting with PHP 8.0.0, with its input hints
, the float
type inputs for those parameters are now rejected.
Casting each of the calculated width and height values back to their integer values corrects those issues.
php8, strict reporting, set declare(strict_types=1); at start of file. Delete contents of bmz_cache to force image generation. Refresh product info page.
$tmpimg = imagecreatetruecolor($newwidth, $newheight);
And if those values are cast, next refresh leads to
PHP Fatal error: Uncaught TypeError: imagecopyresampled(): Argument #8 ($dst_height) must be of type int, float given in includes\classes\bmz_image_handler.class.php:779
and so it goes on....hence some source casting needed.
I note 779 still has a silence operator.