XF\Db\Exception: MySQL query error [1366]: Incorrect string value: '\xF0\x9F\x98\x8D\xF0\x9F

Siraç

Member
Unregistered user has an error like this

Code:
     XF\Db\Exception: MySQL query error [1366]: Incorrect string value: '\xF0\x9F\x98\x8D\xF0\x9F...' for column 'message' at row 1 src/XF/Db/AbstractStatement.php:212
    
     INSERT  INTO `xf_post` (`thread_id`, `message_state`, `user_id`, `username`, `message`, `embed_metadata`, `post_date`, `post_id`, `ip_id`, `attach_count`, `likes`, `like_users`, `warning_id`, `warning_message`, `last_edit_date`, `last_edit_user_id`, `edit_count`, `position`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
------------

#0 src/XF/Db/Mysqli/Statement.php(174): XF\Db\AbstractStatement->getException('MySQL query err...', 1366, 'HY000')
#1 src/XF/Db/Mysqli/Statement.php(69): XF\Db\Mysqli\Statement->getException('MySQL query err...', 1366, 'HY000')
#2 src/XF/Db/AbstractAdapter.php(74): XF\Db\Mysqli\Statement->execute()
#3 src/XF/Db/AbstractAdapter.php(150): XF\Db\AbstractAdapter->query('INSERT  INTO `x...', Array)
#4 src/XF/Mvc/Entity/Entity.php(1381): XF\Db\AbstractAdapter->insert('xf_post', Array)
#5 src/XF/Mvc/Entity/Entity.php(1113): XF\Mvc\Entity\Entity->_saveToSource()
#6 src/XF/Service/Thread/Replier.php(161): XF\Mvc\Entity\Entity->save(true, false)
#7 src/XF/Service/ValidateAndSavableTrait.php(40): XF\Service\Thread\Replier->_save()
#8 src/XF/Pub/Controller/Thread.php(431): XF\Service\Thread\Replier->save()
#9 src/XF/Mvc/Dispatcher.php(249): XF\Pub\Controller\Thread->actionAddReply(Object(XF\Mvc\ParameterBag))
#10 src/XF/Mvc/Dispatcher.php(88): XF\Mvc\Dispatcher->dispatchClass('XF:Thread', 'AddReply', 'json', Object(XF\Mvc\ParameterBag), 'forums', Object(XF\Pub\Controller\Thread), NULL)
#11 src/XF/Mvc/Dispatcher.php(41): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#12 src/XF/App.php(1880): XF\Mvc\Dispatcher->run()
#13 src/XF.php(328): XF\App->run()
#14 index.php(13): XF::runApp('XF\\Pub\\App')
#15 {main}

Durum isteği

array(4) {
  ["url"] => string(73) "/konu/en-onemli-vadiler-hangileridir-turkiyedeki-vadiler.253808/add-reply"
  ["referrer"] => string(92) "https://www.example.com/konu/en-onemli-vadiler-hangileridir-turkiyedeki-vadiler.253808/"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(10) {
    ["message_html"] => string(62) "<p>Çok güzelllll😍😍😍😍😍😍😍😍😍😍</p>"
    ["_xfUsername"] => string(6) "Adsız"
    ["captcha_question_answer"] => string(6) "Şubat"
    ["captcha_question_hash"] => string(40) "4334d919bf384471bd884e21820f62d7be0ac3ac"
    ["last_date"] => string(10) "1418026276"
    ["last_known_date"] => string(10) "1418026276"
    ["_xfToken"] => string(8) "********"
    ["_xfRequestUri"] => string(64) "/konu/en-onemli-vadiler-hangileridir-turkiyedeki-vadiler.253808/"
    ["_xfWithData"] => string(1) "1"
    ["_xfResponseType"] => string(4) "json"
  }
}
 
Hey, I change charset to utf8mb4/utf8mb4_unicode_ci, edit config.php but still have problem with some post:

To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.
 
It was me. All I did was try to add an emoji that has worked for the last two years.

What would have changed in the last few days?

When did this change take place?
 
What would have changed in the last few days?

When did this change take place?
Are you on shared hosting?
Have they recently made any "upgrades" to their infrastructure?
If you are talking about the "true" emojis that are used on phones, utf8mb4 has been required since day one with them once they were enabled.
Do you have shell access? Have you ran php cmd.php xf:convert-utf8mb4 to confirm that your DB has utf8mb4 enabled?
 
I am getting this too:

Full Unicode support has been enabled in config.php but your database is not set to support this. Full Unicode support should be disabled or errors may occur.

I'm guessing it is related.

@Mr. Jinx said this in a different thread:

I had exactly the same. Luckely this was in a test environment.
I resolved this by converting to utf8mb4 before upgrading MariaDB.
After that, the upgrade went fine.

The problem is I have no idea how to adjust these settings in host gator. The guys at host gator said they could only troubleshoot the wordpress part of my site. I'd pay for some personalized support.
 
You have two choices.

1. You run the database conversion which is documented here:


2. You remove $config['fullUnicode'] = true; from the src/config.php file.

Either will solve the problem you’re having but only the first option will allow you to post with emojis.
 
Back
Top Bottom