Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-5428

Search builder: PHP-side lowercasing sometimes breaks for non-US-ASCII characters

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Fixed/Completed
    • Affects Version/s: 3.0.2
    • Fix Version/s: 3.1
    • Component/s: Internationalisation
    • Labels:
      None

      Description

      When creating Search builder queries, the user's input is lowercased on the PHP side (with strtolower()) and then sent to the database as a part of a query.

      strtolower() lowercases according to the current locale, so in a lot of cases (notably not in Ubuntu - hence hard to reproduce on demo and my devel machine...) this simply doesn't work as expected.

      We should either:
      — do a function_exists() check for mb_strtolower() and, if availalble, use that instead of strtolower();
      — find a way to make PHP automatically use mb_strtolower() if the mb_strings module is enabled and the strtolower() function is called;
      — consider using mb_convert_case() instead of strtolower()/mb_strtolower(), as the docs suggest that this is the safest route.

      Note: As mentioned above, this issue is hard to debug (and so any possible solution hard to verify), as in many installs (our demo server, for example) the system locale makes even the strtolower() function work.

        Attachments

          Activity

            People

            • Assignee:
              shot Piotr Szotkowski
              Reporter:
              shot Piotr Szotkowski
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: