Firefox PHP

Illegal mix of collations

Posted by HPeters 
Illegal mix of collations
August 02, 2018 07:51PM
Hello,

We had an user trying to register. The username uses non latin1 characters.

Illegal mix of collations (latin1_general_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '=' (1267): SELECT user_id
FROM phorum_users
WHERE username = 'Metin Yağlıoğlu' LIMIT 1

Backtrace:
----------

Function phorum_database_error called at
{path to Phorum}/include/db/mysql/mysqli.php:212
----
Function phorum_db_interact called at
{path to Phorum}/include/db/mysql.php:3678
----
Function phorum_db_user_search called at
{path to Phorum}/include/api/user.php:1241
----
Function phorum_api_user_search called at
{path to Phorum}/register.php:114
----

This is a known MySQL issue to me, but hard to fix without messing up everything. Both way of fixing this that I know of has it's problems. Changing phorum_users to utf8mb4 would require to extend the length of phorum_users 4 times longer to avoid issues.

Coerce the comparison to ignore these kinds of issues, has security implications.

I also have to add, that our phorum data went through 2 server upgrades, which both times used a newer MySQL version, so this issue probably was technically possible after MySQL added utfmb4 support a few years ago. The MySQL connection in use is by default configured to handle utfmb4 input. From that we cannot go back

Has anyone else had this issue? How did you solve it?

Thanks in advance for any suggestions.
Sorry, only registered users may post in this forum.

Click here to login