[dev/core#412] Avoid truncated UTF-8 strings when using substr()
authorJens Schuppe <schuppe@systopia.de>
Mon, 15 Oct 2018 09:14:51 +0000 (11:14 +0200)
committerJens Schuppe <schuppe@systopia.de>
Mon, 15 Oct 2018 09:14:51 +0000 (11:14 +0200)
CRM/Core/BAO/Mapping.php

index 1764cd572f1a7fe2ecfbefeea1835f4af4414315..3e8b324a360b1e12130cd9b8684af34159874402 100644 (file)
@@ -997,9 +997,7 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping {
       $customGroupId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField', $customFieldId, 'custom_group_id');
       $customGroupName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $customGroupId, 'title');
 
-      if (strlen($customGroupName) > 13) {
-        $customGroupName = substr($customGroupName, 0, 10) . '...';
-      }
+      $customGroupName = CRM_Utils_String::ellipsify($customGroupName, 13);
 
       return $customGroupName;
     }