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

Fatal error when strings are truncated

    Details

    • Documentation Required?:
      None
    • Funding Source:
      Contributed Code

      Description

      The CRM_Utils_String::ellipsify() function is not multi-byte safe, and can therefore create database errors when truncating the strings in the middle of a multi-byte character.

      Here is an example of such a message, happening with an online event registration:
      INSERT INTO civicrm_participant (contact_id , event_id , status_id , role_id , register_date , source , fee_level , is_test , is_pay_later , fee_amount , discount_id , fee_currency ) VALUES ( 7552 , 256 , 5 , '1' , 20160622134255 , 'Registro de eventos on-line: Taller: \"Onboarding - Cómo integrar exitosamente a los nuevos talentos dentro de su organizaci�...' , ' No Asociados, IVA incluido - 1 ' , 0 , 1 , 766.00 , NULL , 'MXN' ) [nativecode=1366 ** Incorrect string value: '\xC3...' for column 'source' at row 1]

      The word 'organización' has been wrongly ellipsified in the middle of the 'ó' multi-byte character, therefore creating an invalid UTF-8 code.

        Attachments

          Activity

            People

            • Assignee:
              sunil Sunil Pawar
              Reporter:
              nganivet Nicolas Ganivet
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 15 minutes
                15m
                Remaining:
                Remaining Estimate - 15 minutes
                15m
                Logged:
                Time Spent - Not Specified
                Not Specified