Make WordPress Core

Opened 2 years ago

Last modified 2 years ago

#46947 new defect (bug)

‘❤’ in Comment Generates DB Error

Reported by: HisKingdomProphecy Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 5.1.1
Component: Database Keywords: needs-testing needs-patch reporter-feedback
Focuses: Cc:


I got the following error message notice when a post comment included the ‘’ special character.
When I approved the comment, there was no further error message generated.
I have not seen this message before – but then again, we rarely get special character in comments.
I am using WordPress 5.1.1. The WP-config: ‘define(‘DB_CHARSET’, ‘utf8′);’
Can someone please advise how to fix this?

Regards and thanks,

Error message:
* [Thu Mar 21 02:17:57.574584 2019] [php7:notice] [pid 24789] [client] WordPress database error Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8mb4_unicode_ci,COERCIBLE) for operation ‘=’ for query SELECT comment_ID FROM xxxcomments WHERE comment_post_ID = 134978 AND comment_parent = ‘0’ AND comment_approved != ‘trash’ AND ( comment_author = ‘Rhonda Lott’ AND comment_author_email = ‘xxx@…’ ) AND comment_content = ‘Amen And Amen! Thank you Rabbi!\xe2\x9d\xa4\xf0\x9f\x94\xa5\xf0\x9f\x92\xaf\xf0\x9f\x99\x8c’ LIMIT 1 made by wp_handle_comment_submission, wp_new_comment, wp_allow_comment, referer: https://www.hiskingdomprophecy.com/its-time-to-unearth-the-truth/ *

Change History (4)

#1 @SergeyBiryukov
2 years ago

  • Component changed from General to Database
  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to Future Release

Hi @HisKingdomProphecy, welcome to WordPress Trac!

Thanks for the ticket, I was able to reproduce the issue.

#2 @subrataemfluence
2 years ago

Sorry for asking this question when @SergeyBiryukov already reproduced the issue.

I may have done it wrong way, but when I posted this comment Jesus ❤ you, it got saved without any error notification and displayed perfectly. Also when I edited and saved the comment I didn't get into any issue either. It is still displaying correctly after edit.

I also have define( 'DB_CHARSET', 'utf8' ); set in my wp-config.php.

Would you mind placing the exact steps here to reproduce?

#3 @subrataemfluence
2 years ago

  • Keywords reporter-feedback added

#4 @ayeshrajans
2 years ago

I'm pretty sure @subrataemfluence is onto the root. Heart emoji is not under the utf8 Charest in MySQL, and requires ut8mb4.

Note: See TracTickets for help on using tickets.