1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Fixed XenForo_Model_UserTagging::_getTagMatchUsers not utf8 safe

Discussion in 'Resolved Bug Reports' started by Xon, May 30, 2016.

  1. Xon

    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.
    eva2000 likes this.
  2. Mike

    Mike XenForo Developer Staff Member

    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.
    Xon likes this.
  3. Xon

    Xon Well-Known Member

    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).
  4. Mike

    Mike XenForo Developer Staff Member

    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!
    semprot and Xon like this.

Share This Page