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.
 
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XFRM release (2.3.4).

Change log:
Gracefully handle when resource icon cannot be loaded
There may be a delay before changes are rolled out to the XenForo Community.
 
Back
Top Bottom