Skip to content

Bug: Incorrect string value for Page account when inserting Emoji #980

Open
@q2apro

Description

Replicate Bug:

  1. Edit your account
  2. Insert "Test 👍" into the Name field
  3. Save

Result:

PHP Question2Answer MySQL query error 1366: Incorrect string value: '\xF0\x9F\x91\x8D' for column 'content' at row 1 - Query: INSERT INTO qa_userprofile (userid, title, content) VALUES ('1', 'name', 'Test 👍') ON DUPLICATE KEY UPDATE content = VALUES(content)

Solution:

Probably we could clean the value in "qa-include/db/users.php":

function qa_db_user_profile_set($userid, $field, $value)

adding simply:

$value = qa_remove_utf8mb4($value);

Other solution:

The DB fields content and title are utf8mb3_general_ci. They could be altered to utf8mb4_general_ci to accept emojis. But probably for now the PHP solution is preferable.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions