XF 2.1 Incorrect string value on instagram embed

FloV

Well-known member
Hey,

i've figured out a strange behaviour.

I was trying to make a new post with just an instagram link / embed but it didn't went through. All i got was this:

Code:
XF\Db\Exception: MySQL query error [1366]: Incorrect string value: '\xF0\x9F\x98\x8A\xF0\x9F...' for column 'title' at row 1 src/XF/Db/AbstractStatement.php:228
Generiert von: Flo 10 Dezember 2019 um 09:14

Stack-Trace
UPDATE  `xf_oembed` SET `is_processing` = ?, `fetch_date` = ?, `title` = ? WHERE `oembed_id` = 3
------------

#0 src/XF/Db/Mysqli/Statement.php(196): XF\Db\AbstractStatement->getException('MySQL query err...', 1366, 'HY000')
#1 src/XF/Db/Mysqli/Statement.php(77): XF\Db\Mysqli\Statement->getException('MySQL query err...', 1366, 'HY000')
#2 src/XF/Db/AbstractAdapter.php(94): XF\Db\Mysqli\Statement->execute()
#3 src/XF/Db/AbstractAdapter.php(326): XF\Db\AbstractAdapter->query('UPDATE  `xf_oem...', Array)
#4 src/XF/Mvc/Entity/Entity.php(1457): XF\Db\AbstractAdapter->update('xf_oembed', Array, '`oembed_id` = 3')
#5 src/XF/Mvc/Entity/Entity.php(1184): XF\Mvc\Entity\Entity->_saveToSource()
#6 src/XF/Service/Oembed.php(247): XF\Mvc\Entity\Entity->save()
#7 src/XF/Service/Oembed.php(103): XF\Service\Oembed->finalizeFromFetchResults(Object(XF\Entity\Oembed), Array)
#8 src/XF/Service/Oembed.php(39): XF\Service\Oembed->refetchOembed(Object(XF\Entity\Oembed))
#9 src/XF/BbCode/ProcessorAction/AutoLink.php(483): XF\Service\Oembed->getOembed('instagram', 'B5nXMOgICvM')
#10 src/XF/BbCode/ProcessorAction/AutoLink.php(468): XF\BbCode\ProcessorAction\AutoLink->cacheOembedResponse(Object(XF\Entity\BbCodeMediaSite), 'B5nXMOgICvM')
#11 src/XF/BbCode/ProcessorAction/AutoLink.php(246): XF\BbCode\ProcessorAction\AutoLink->getEmbedBbCode('https://www.ins...')
#12 src/XF/BbCode/ProcessorAction/AutoLink.php(418): XF\BbCode\ProcessorAction\AutoLink->getMediaTagIfPermitted('https://www.ins...')
#13 src/XF/BbCode/ProcessorAction/AutoLink.php(143): XF\BbCode\ProcessorAction\AutoLink->unfurlLinkUrl('https://www.ins...')
#14 [internal function]: XF\BbCode\ProcessorAction\AutoLink->XF\BbCode\ProcessorAction\{closure}(Array)
#15 src/XF/BbCode/ProcessorAction/AutoLink.php(154): preg_replace_callback('#^(?<=[^a-z0-9@...', Object(Closure), 'https://www.ins...')
#16 [internal function]: XF\BbCode\ProcessorAction\AutoLink->filterString('https://www.ins...', Array, Object(XF\BbCode\Processor))
#17 src/XF/BbCode/Processor.php(375): call_user_func(Array, 'https://www.ins...', Array, Object(XF\BbCode\Processor))
#18 src/XF/BbCode/Processor.php(358): XF\BbCode\Processor->filterString('https://www.ins...', Array)
#19 src/XF/BbCode/Traverser.php(65): XF\BbCode\Processor->renderString('https://www.ins...', Array)
#20 src/XF/BbCode/Traverser.php(37): XF\BbCode\Traverser->renderSubTree(Array, Array)
#21 src/XF/BbCode/Traverser.php(20): XF\BbCode\Traverser->renderAst(Array, Object(XF\BbCode\RuleSet), Array)
#22 src/XF/Service/Message/Preparer.php(160): XF\BbCode\Traverser->render('https://www.ins...', Object(XF\BbCode\Parser), Object(XF\BbCode\RuleSet), Array)
#23 src/XF/Service/Message/Preparer.php(122): XF\Service\Message\Preparer->processMessage('https://www.ins...')
#24 src/XF/Service/Post/Preparer.php(98): XF\Service\Message\Preparer->prepare('https://www.ins...', true)
#25 src/XF/Service/Thread/Replier.php(107): XF\Service\Post\Preparer->setMessage('https://www.ins...', true, true)
#26 src/XF/Pub/Controller/Thread.php(318): XF\Service\Thread\Replier->setMessage('https://www.ins...')
#27 src/XF/Pub/Controller/Thread.php(453): XF\Pub\Controller\Thread->setupThreadReply(Object(XF\Entity\Thread))
#28 src/XF/Mvc/Dispatcher.php(350): XF\Pub\Controller\Thread->actionAddReply(Object(XF\Mvc\ParameterBag))
#29 src/XF/Mvc/Dispatcher.php(261): XF\Mvc\Dispatcher->dispatchClass('XF:Thread', 'AddReply', Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\Thread), NULL)
#30 src/XF/Mvc/Dispatcher.php(113): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\Thread), NULL)
#31 src/XF/Mvc/Dispatcher.php(55): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#32 src/XF/App.php(2184): XF\Mvc\Dispatcher->run()
#33 src/XF.php(391): XF\App->run()
#34 index.php(20): XF::runApp('XF\\Pub\\App')
#35 {main}

All AddOns (just 3) are disabled through config.php. Do you have an idea whats happening here?

All the best

Florian
 
This does not seem like a bug to me:

The database (that was most likely upgraded from 1.5) is not using utf8mb4, this is required for characters like Emojis.

Call php cmd.php xf:convert-utf8mb4 from the console (SSH) to convert the tables and put $config['fullUnicode'] = true; in config.php afterwards.
 
So, i just figured out something else

This posting doesn't work:

https://www.instagram.com/p/B5ully_o9GG/?igshid=gdq2qd5f050u

This post does work:

[MEDIA=instagram]B5ully_o9GG[/MEDIA]
 
This would only happen if the definition of the xf_oembed table was incorrect. This can sometimes happen if the table had come in from a backup which didn't support utf8mb4 or it was manually created for some reason.

You can verify the configuration of the table with the query SHOW CREATE TABLE xf_oembed.

Might be worth running the command listed by @Kirby anyway - it will detect any tables that aren't utf8mb4 even in cases where they should be.
 
Top Bottom