Fixed InvalidArgumentException: Failed to convert to JSON. Error: Malformed UTF-8 characters, possibly incorrectly encoded [exif_data]

mcatze

Well-known member
Affected version
2.1.0 Release Candidate 1
If i want to upload an image, i got this error. But not every image. Attached a example of the image.
Code:
InvalidArgumentException: Failed to convert to JSON. Error: Malformed UTF-8 characters, possibly incorrectly encoded [exif_data] src/XF/Mvc/Entity/Entity.php:740
Generated by: McAtze Jan 18, 2019 at 10:04 PM

Stack trace
#0 src/XF/Mvc/Entity/Entity.php(618): XF\Mvc\Entity\Entity->_castValueToType(Array, 'exif_data', 65552, Array)
#1 src/XF/Mvc/Entity/Entity.php(548): XF\Mvc\Entity\Entity->set('exif_data', Array)
#2 src/addons/XFMG/Service/Media/TempCreator.php(108): XF\Mvc\Entity\Entity->__set('exif_data', Array)
#3 src/addons/XFMG/Attachment/Media.php(138): XFMG\Service\Media\TempCreator->setExif(Array)
#4 src/XF/Service/Attachment/Preparer.php(232): XFMG\Attachment\Media->onNewAttachment(Object(XF\Entity\Attachment), Object(XF\FileWrapper))
#5 src/XF/Service/Attachment/Preparer.php(24): XF\Service\Attachment\Preparer->insertTemporaryAttachment(Object(XFMG\Attachment\Media), Object(XF\Entity\AttachmentData), '6b18ca2c56c4bd7...', Object(XF\FileWrapper))
#6 src/XF/Attachment/Manipulator.php(170): XF\Service\Attachment\Preparer->insertAttachment(Object(XFMG\Attachment\Media), Object(XF\FileWrapper), Object(xenMade\UASD\XF\Entity\User), '6b18ca2c56c4bd7...')
#7 src/XF/Pub/Controller/Attachment.php(88): XF\Attachment\Manipulator->insertAttachmentFromUpload(Object(XF\Http\Upload), NULL)
#8 src/XF/Mvc/Dispatcher.php(321): XF\Pub\Controller\Attachment->actionUpload(Object(XF\Mvc\ParameterBag))
#9 src/XF/Mvc/Dispatcher.php(248): XF\Mvc\Dispatcher->dispatchClass('XF:Attachment', 'Upload', Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\Attachment), NULL)
#10 src/XF/Mvc/Dispatcher.php(100): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\Attachment), NULL)
#11 src/XF/Mvc/Dispatcher.php(50): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#12 src/XF/App.php(2177): XF\Mvc\Dispatcher->run()
#13 src/XF.php(392): XF\App->run()
#14 index.php(20): XF::runApp('XF\\Pub\\App')
#15 {main}

-------------

Previous InvalidArgumentException: Failed to convert to JSON. Error: Malformed UTF-8 characters, possibly incorrectly encoded - src/XF/Mvc/Entity/ValueFormatter.php:164
#0 src/XF/Mvc/Entity/Entity.php(736): XF\Mvc\Entity\ValueFormatter->castValueToType(Array, 65552, Array)
#1 src/XF/Mvc/Entity/Entity.php(618): XF\Mvc\Entity\Entity->_castValueToType(Array, 'exif_data', 65552, Array)
#2 src/XF/Mvc/Entity/Entity.php(548): XF\Mvc\Entity\Entity->set('exif_data', Array)
#3 src/addons/XFMG/Service/Media/TempCreator.php(108): XF\Mvc\Entity\Entity->__set('exif_data', Array)
#4 src/addons/XFMG/Attachment/Media.php(138): XFMG\Service\Media\TempCreator->setExif(Array)
#5 src/XF/Service/Attachment/Preparer.php(232): XFMG\Attachment\Media->onNewAttachment(Object(XF\Entity\Attachment), Object(XF\FileWrapper))
#6 src/XF/Service/Attachment/Preparer.php(24): XF\Service\Attachment\Preparer->insertTemporaryAttachment(Object(XFMG\Attachment\Media), Object(XF\Entity\AttachmentData), '6b18ca2c56c4bd7...', Object(XF\FileWrapper))
#7 src/XF/Attachment/Manipulator.php(170): XF\Service\Attachment\Preparer->insertAttachment(Object(XFMG\Attachment\Media), Object(XF\FileWrapper), Object(xenMade\UASD\XF\Entity\User), '6b18ca2c56c4bd7...')
#8 src/XF/Pub/Controller/Attachment.php(88): XF\Attachment\Manipulator->insertAttachmentFromUpload(Object(XF\Http\Upload), NULL)
#9 src/XF/Mvc/Dispatcher.php(321): XF\Pub\Controller\Attachment->actionUpload(Object(XF\Mvc\ParameterBag))
#10 src/XF/Mvc/Dispatcher.php(248): XF\Mvc\Dispatcher->dispatchClass('XF:Attachment', 'Upload', Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\Attachment), NULL)
#11 src/XF/Mvc/Dispatcher.php(100): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\Attachment), NULL)
#12 src/XF/Mvc/Dispatcher.php(50): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#13 src/XF/App.php(2177): XF\Mvc\Dispatcher->run()
#14 src/XF.php(392): XF\App->run()
#15 index.php(20): XF::runApp('XF\\Pub\\App')
#16 {main}

Request state
array(4) {
  ["url"] => string(97) "/attachments/upload?type=xfmg_media&context[category_id]=19&hash=6b18ca2c56c4bd7d9a135b6086367e5e"
  ["referrer"] => string(74) "https://www.xxxxxx.de/media/categories/dcm-stammtische-2015.19/add"
  ["_GET"] => array(3) {
    ["type"] => string(10) "xfmg_media"
    ["context"] => array(1) {
      ["category_id"] => string(2) "19"
    }
    ["hash"] => string(32) "6b18ca2c56c4bd7d9a135b6086367e5e"
  }
  ["_POST"] => array(11) {
    ["_xfToken"] => string(8) "********"
    ["_xfResponseType"] => string(4) "json"
    ["_xfWithData"] => string(1) "1"
    ["flowChunkNumber"] => string(1) "1"
    ["flowChunkSize"] => string(10) "4294967296"
    ["flowCurrentChunkSize"] => string(6) "331458"
    ["flowTotalSize"] => string(6) "331458"
    ["flowIdentifier"] => string(23) "331458-IMG_5289Largejpg"
    ["flowFilename"] => string(20) "IMG_5289 (Large).jpg"
    ["flowRelativePath"] => string(20) "IMG_5289 (Large).jpg"
    ["flowTotalChunks"] => string(1) "1"
  }
}
 

Attachments

  • IMG_5106 (Andere).webp
    IMG_5106 (Andere).webp
    16.5 KB · Views: 9
This was posted 9pm on Friday and it's still Sunday so honestly I haven't really had a chance to look into it at this point.
 
Back
Top Bottom