Fixed XFRM\Service\ResourceItem\Icon::updateIcon can fail with an internal server error instead of returning false

Xon

Well-known member
Affected version
2.3.3
Previously updateIcon had a guard statement around if imageFromFile failed, but the added isOptimized check misses that.


PHP:
$baseImage = $imageManager->imageFromFile($this->fileName);
$isOptimized = $baseImage->getType() === IMAGETYPE_WEBP;
unset($baseImage);

if ($this->width != $targetSize || $this->height != $targetSize)
{
    $image = $imageManager->imageFromFile($this->fileName);
    if (!$image)
    {
        return false;
    }

This can result in an internal server instead of failing and giving an error message to the user. Also, this can load the image twice in the same function which feels quite redundant.
 
Back
Top Bottom