Fixed ErrorException: [E_DEPRECATED] Implicit conversion from float 16.5296 to int loses precision src/XF/Image/Gd.php:311

TickTackk

Well-known member
Affected version
two point two point four
When adding media item of embed type on PHP 8.1 I get this exception
Code:
#0 src/XF/Image/Gd.php(311): XF::handlePhpError(8192, '[E_DEPRECATED] ...', '/var/www/xenfor...', 311)
#1 src/XF/Image/AbstractDriver.php(265): XF\Image\Gd->_unsharpMask(4, 0.5, 0.0112, 0)
#2 src/addons/XFMG/Service/Media/ThumbnailGenerator.php(261): XF\Image\AbstractDriver->unsharpMask()
#3 src/addons/XFMG/Service/Media/ThumbnailGenerator.php(164): XFMG\Service\Media\ThumbnailGenerator->generateThumbnailFromFile('/var/www/xenfor...')
#4 src/addons/XFMG/Service/Media/TempCreator.php(203): XFMG\Service\Media\ThumbnailGenerator->getTempThumbnailFromImage('/var/www/xenfor...', 'data://xfmg/tem...')
#5 src/XF/Service/ValidateAndSavableTrait.php(42): XFMG\Service\Media\TempCreator->_save()
#6 src/addons/XFMG/Pub/Controller/Media.php(597): XFMG\Service\Media\TempCreator->save()
#7 src/XF/Mvc/Dispatcher.php(352): XFMG\Pub\Controller\Media->actionEmbedMedia(Object(XF\Mvc\ParameterBag))
#8 src/XF/Mvc/Dispatcher.php(259): XF\Mvc\Dispatcher->dispatchClass('XFMG:Media', 'EmbedMedia', Object(XF\Mvc\RouteMatch), Object(XFMG\Pub\Controller\Media), NULL)
#9 src/XF/Mvc/Dispatcher.php(115): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(XFMG\Pub\Controller\Media), NULL)
#10 src/XF/Mvc/Dispatcher.php(57): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#11 src/XF/App.php(2351): XF\Mvc\Dispatcher->run()
#12 src/XF.php(517): XF\App->run()
#13 index.php(20): XF::runApp('XF\\Pub\\App')
#14 {main}
 

XF Bug Bot

XenForo bug fixer bot
Staff member
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 XF release (2.2.9).

Change log:
Improve PHP 8.1 compatibility within the unsharp image mask algorithm
There may be a delay before changes are rolled out to the XenForo Community.
 
Top