Fixed php8 exif error on MG

briansol

Well-known member
upgraded to php8 and am getting this in my acp (2.2.5 XF)

Code:
Server error log
[LIST]
[*]ErrorException: Template error: [E_WARNING] A non-numeric value encountered
[*]src/addons/XFMG/Exif/Formatter.php:152
[*]Generated by: Unknown account
[*]May 5, 2021 at 12:04 PM
[/LIST]
[HEADING=2]Stack trace[/HEADING]
#0 src/addons/XFMG/Exif/Formatter.php(152): XF\Template\Templater->handleTemplateError(2, '[E_WARNING] A n...', '/home/xxxxx/pub...', 152)
#1 src/addons/XFMG/Exif/Formatter.php(73): XFMG\Exif\Formatter->simplifyValue(Array)
#2 internal_data/code_cache/templates/l1/s12/public/xfmg_media_view_macros.php(692): XFMG\Exif\Formatter->offsetGet('exposure')
#3 src/XF/Template/Templater.php(801): XF\Template\Templater->{closure}(Object(MaZ\AMP\XF\Template\XF22\Templater), Array, NULL)
#4 src/addons/MaZ/AMP/XF/Template/Templater.php(130): XF\Template\Templater->callMacro('xfmg_media_view...', 'exif_sidebar', Array, Array, Object(XF\Template\MacroState))
#5 internal_data/code_cache/templates/l1/s12/public/xfmg_media_view.php(604): MaZ\AMP\XF\Template\Templater->callMacro('xfmg_media_view...', 'exif_sidebar', Array, Array)
#6 src/XF/Template/Templater.php(1628): XF\Template\Templater->{closure}(Object(MaZ\AMP\XF\Template\XF22\Templater), Array, NULL)
#7 src/addons/MaZ/AMP/XF/Template/XF22/Templater.php(52): XF\Template\Templater->renderTemplate('xfmg_media_view', Array, true, NULL)
#8 src/XF/Template/Template.php(24): MaZ\AMP\XF\Template\XF22\Templater->renderTemplate('public:xfmg_med...', Array)
#9 src/XF/Mvc/Renderer/Html.php(48): XF\Template\Template->render()
#10 src/XF/Mvc/Dispatcher.php(458): XF\Mvc\Renderer\Html->renderView('XFMG:Media\\View', 'public:xfmg_med...', Array)
#11 src/XF/Mvc/Dispatcher.php(440): XF\Mvc\Dispatcher->renderView(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#12 src/XF/Mvc/Dispatcher.php(400): XF\Mvc\Dispatcher->renderReply(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#13 src/XF/Mvc/Dispatcher.php(58): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'html')
#14 src/XF/App.php(2337): XF\Mvc\Dispatcher->run()
#15 src/XF.php(488): XF\App->run()
#16 index.php(20): XF::runApp('XF\\Pub\\App')
#17 {main}
[HEADING=2]Request state[/HEADING]
array(4) {
  ["url"] => string(17) "/media/toys.5051/"
  ["referrer"] => bool(false)
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(0) {
  }
}


my php info for exif looks like:


exif​

EXIF Supportenabled
Supported EXIF Version0220
Supported filetypesJPEG, TIFF
Multibyte decoding support using mbstringenabled
Extended EXIF tag formatsCanon, Casio, Fujifilm, Nikon, Olympus, Samsung, Panasonic, DJI, Sony, Pentax, Minolta, Sigma, Foveon, Kyocera, Ricoh, AGFA, Epson
DirectiveLocal ValueMaster Value
exif.decode_jis_intelJISJIS
exif.decode_jis_motorolaJISJIS
exif.decode_unicode_intelUCS-2LEUCS-2LE
exif.decode_unicode_motorolaUCS-2BEUCS-2BE
exif.encode_jisno valueno value
exif.encode_unicodeISO-8859-15ISO-8859-15

 

Mike

XenForo developer
Staff member
Is this the only media item that seems to be triggering the error? (Based on the URL in the request state.)

I'll move this to bugs as it's something we potentially need to protect against. However, I'm not clear what data format might be here. We may need to get access to the stored EXIF data for this particular image.
 

briansol

Well-known member
No, there are about 8 logs that popped up so far, all different images. i deleted them after posting this, unfortunately.
 

Chris D

XenForo developer
Staff member
That's fine we may just need the EXIF data pulling out of the database so we can take a closer look.

SQL:
SELECT exif_data
FROM xf_mg_media_item
WHERE media_id = 5051

That should get us the raw EXIF data which pertains to the original image that triggered the error for us to test against.
 

briansol

Well-known member
Code:
{"FILE":{"FileName":"18959-066e88636538547a57ec684c7d336aa9.data","FileDateTime":"1401247489","FileSize":"155298","FileType":"2","MimeType":"image\/jpeg","SectionsFound":"ANY_TAG, IFD0, THUMBNAIL, EXIF, INTEROP"},"COMPUTED":{"html":"width=\"640\" height=\"480\"","Height":"480","Width":"640","IsColor":"1","ByteOrderMotorola":"1","ExposureTime":"0.125 s (1\/8)","Thumbnail.FileType":"2","Thumbnail.MimeType":"image\/jpeg"},"IFD0":{"Make":"Samsung Electronics","Model":"SGH-A877","Orientation":"1","XResolution":"72\/1","YResolution":"72\/1","ResolutionUnit":"2","Software":"A877UCID3-0000000000","YCbCrPositioning":"1","Exif_IFD_Pointer":"218","UndefinedTag:0xC4A5":"PrintIM\u00000300\u0000\u0000\u0000\u0000"},"THUMBNAIL":{"Compression":"6","XResolution":"72\/1","YResolution":"72\/1","ResolutionUnit":"2","JPEGInterchangeFormat":"600","JPEGInterchangeFormatLength":"18655"},"EXIF":{"ExposureProgram":"2","ExifVersion":"0220","DateTimeOriginal":"2010:08:02 18:41:33","DateTimeDigitized":"2010:08:02 18:41:33","ComponentsConfiguration":"\u0002\u0003\u0000","ShutterSpeedValue":"3072\/1024","MeteringMode":"1","FlashPixVersion":"0100","ColorSpace":"1","ExifImageWidth":"640","ExifImageLength":"480","InteroperabilityOffset":"476","FileSource":"\u0003","CustomRendered":"1","ExposureMode":"0","WhiteBalance":"0"},"INTEROP":{"InterOperabilityIndex":"R98","InterOperabilityVersion":"0100"}}
 

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 XFMG release (2.2.3).

Change log:
Fix non-numeric value error when formatting EXIF exposure time values.
There may be a delay before changes are rolled out to the XenForo Community.
 
Top