Fixed XenForo_Model_UserTagging::_getTagMatchUsers not utf8 safe

Xon

Well-known member
getTagMatchUsers uses strtolower and not utf8_strtolower to generate the lowercased username.

This may cause usernames with utf8 multi-byte encoded usernames to fail to match due to strtolower mangling the lowercase translation.
 
Just to clarify, is this a byte mangling issue or a failed (false negative) match? I don't think byte mangling should be an issue here because it's about consistency in comparison; as long as the bytes are mangled the same way through the actions, it should still allow a match. (Byte mangling shouldn't generally happen either, unless the locale is something outside of "C"; locale things are a bit of an issue in PHP, especially as they're not thread safe.)

Alternatively, I could see this being an issue where a user uses a multi-byte UTF-8 character in a different case to the user's name. That's not how I originally approached looking into this bug report though, so I just want to clarify.
 
Sorry. 'byte mangling' was the incorrect term.

I ment a false negative due to a user entering in lowercase which when passed through strtolower maps to the incorrect unicode string for a username with uppercase multi-byte characters. (or vis-versa depending on the insanity that is unicode case folding).
 
Right, this is fixed now then and case-insensitive matching should generally work for names with accents now. Changing the 3 strtolower references to utf8_strtolower is sufficient. Thanks!
 
Back
Top Bottom