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

String validation fails on string length

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.4.5
    • Fix Version/s: 4.4.6
    • Component/s: CiviCRM API
    • Labels:
      None

      Description

      In the function _civicrm_api3_validate_string() (api/v3/utils.php)

      The code to count the string length is strlen($value), which count bytes instead of chars. That means non-utf8 strings are not handled because in most cases non-utf8 char takes 2 bytes.

      This has a lot of consequences because this function is used multiple times, the most obvious is for exemple we can't create a contact using the API if the name is on 128 chars with at least one accent (é, è, ...)

      This affects only the API, "native" forms are ok.

        Attachments

          Activity

            People

            • Assignee:
              eileen Eileen McNaughton
              Reporter:
              antoinev Antoine V
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: