Page MenuHomePhabricator

UTF8 user names with PostgreSQL backend cause login errors
Closed, ResolvedPublic

Description

Author: alo

Description:
A quick patch to fix this.

When a user whose name contain UTF8-encoded characters, tries to log in, PostgreSQL complains of illegal characters in the query. For example, user name "Pertti Höytylä", UTF8 encoding in hex "5065727474692048c3b67974796cc3a4", causes this error.

A database error has occurred Query: UPDATE mwuser SET user_touched = 'xxx' WHERE user_id = '1122' Function: User::invalidateCache Error: 1 ERROR: invalid byte sequence for encoding "UTF8": 0xc32e HINT: This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by "client_encoding".

The problem is in includes/Database.php, where the user name put in the SQL query comment after being truncated to 15 bytes (in the encoded form). Sometimes this breaks in the mmiddle of UTF8 characters and causes invalid encoding which is not acceptable by PostgreSQL backend. Truncation should be done in UTF8-aware way.


Version: 1.11.x
Severity: major

Attached:

Details

Reference
bz12735

Related Objects

View Standalone Graph
This task is connected to more than 200 other tasks. Only direct parents and subtasks are shown here. Use View Standalone Graph to show more of the graph.
StatusSubtypeAssignedTask
InvalidNone
ResolvedNone

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:01 PM
bzimport set Reference to bz12735.
bzimport added a subscriber: Unknown Object (MLST).

Made a fix in r30536, please test it out.

Jdforrester-WMF subscribed.

Migrating from the old tracking task to a tag for PostgreSQL-related tasks.