XF 2.0 UTF8MB4 : Incorrect string value: '\xF0\x9F\x98\x83,\x0A' - but I don't know where is the wrong string...

Jean-Baptiste

Well-known member
Hello,

I am installing one of my addons on a XF 2.0 forum, that didn't enabled UTF8MB4.

When it's installing the addon, I got the following error :
Code:
XF\Db\Exception: MySQL query error [1366]: Incorrect string value: '\xF0\x9F\x98\x83,\x0A...' for column 'phrase_text' at row 1 in src/XF/Db/AbstractStatement.php at line 212
XF\Db\AbstractStatement->getException() in src/XF/Db/Mysqli/Statement.php at line 196
XF\Db\Mysqli\Statement->getException() in src/XF/Db/Mysqli/Statement.php at line 77
XF\Db\Mysqli\Statement->execute() in src/XF/Db/AbstractAdapter.php at line 79
XF\Db\AbstractAdapter->query() in src/XF/Db/AbstractAdapter.php at line 160
XF\Db\AbstractAdapter->insert() in src/XF/Mvc/Entity/Entity.php at line 1409
XF\Mvc\Entity\Entity->_saveToSource() in src/XF/Mvc/Entity/Entity.php at line 1141
XF\Mvc\Entity\Entity->save() in src/XF/AddOn/DataType/Phrase.php at line 78
XF\AddOn\DataType\Phrase->importAddOnData() in src/XF/Job/AddOnData.php at line 108
XF\Job\AddOnData->run() in src/XF/Job/Manager.php at line 241
XF\Job\Manager->runJobInternal() in src/XF/Job/Manager.php at line 187
XF\Job\Manager->runJobEntry() in src/XF/Job/Manager.php at line 103
XF\Job\Manager->runByIds() in src/XF/Admin/Controller/Tools.php at line 120
XF\Admin\Controller\Tools->actionRunJob() in src/XF/Mvc/Dispatcher.php at line 249
XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 88
XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 41
XF\Mvc\Dispatcher->run() in src/XF/App.php at line 1934
XF\App->run() in src/XF.php at line 333
XF::runApp() in admin.php at line 13

Code:
INSERT  INTO `xf_phrase` (`addon_id`, `title`, `version_id`, `version_string`, `language_id`, `global_cache`, `phrase_text`, `phrase_id`) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
------------

#0 src/XF/Db/Mysqli/Statement.php(196): XF\Db\AbstractStatement->getException('MySQL query err...', 1366, '22007')
#1 src/XF/Db/Mysqli/Statement.php(77): XF\Db\Mysqli\Statement->getException('MySQL query err...', 1366, '22007')
#2 src/XF/Db/AbstractAdapter.php(79): XF\Db\Mysqli\Statement->execute()
#3 src/XF/Db/AbstractAdapter.php(160): XF\Db\AbstractAdapter->query('INSERT  INTO `x...', Array)
#4 src/XF/Mvc/Entity/Entity.php(1409): XF\Db\AbstractAdapter->insert('xf_phrase', Array, false)
#5 src/XF/Mvc/Entity/Entity.php(1141): XF\Mvc\Entity\Entity->_saveToSource()
#6 src/XF/AddOn/DataType/Phrase.php(78): XF\Mvc\Entity\Entity->save(true, false)
#7 src/XF/Job/AddOnData.php(108): XF\AddOn\DataType\Phrase->importAddOnData('Appify', Object(SimpleXMLElement), 0, G)
#8 src/XF/Job/Manager.php(241): XF\Job\AddOnData->run(G)
#9 src/XF/Job/Manager.php(187): XF\Job\Manager->runJobInternal(Array, G)
#10 src/XF/Job/Manager.php(76): XF\Job\Manager->runJobEntry(Array, G)
#11 src/XF/Admin/Controller/Tools.php(139): XF\Job\Manager->runQueue(true, 8)
#12 src/XF/Mvc/Dispatcher.php(249): XF\Admin\Controller\Tools->actionRunJob(Object(XF\Mvc\ParameterBag))
#13 src/XF/Mvc/Dispatcher.php(88): XF\Mvc\Dispatcher->dispatchClass('XF:Tools', 'RunJob', 'html', Object(XF\Mvc\ParameterBag), 'tools', Object(XF\Admin\Controller\Tools), NULL)
#14 src/XF/Mvc/Dispatcher.php(41): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#15 src/XF/App.php(1934): XF\Mvc\Dispatcher->run()
#16 src/XF.php(333): XF\App->run()
#17 admin.php(13): XF::runApp('XF\\Admin\\App')
#18 {main}

The problem is that I don't think I am using any UTF8MB4 characters in my addon.
Do you know why ? That's very strange, I removed every UTF8MB4 chars in the addon...

Best regards,
Jean-Baptiste
 
The error is saying that there is a phrase which contains the following phrase_text in the Appify add-on:
Code:
😃,
That's the un-encoded version of what is in the error \xF0\x9F\x98\x83,
 
Back
Top Bottom