CRM-20508 - fixed creating custom fields when all chars are non-ascii on Label field
[civicrm-core.git] / CRM / Utils / String.php
index 5fdeb91b75db842a024fb123363c8f9f8cd5748f..cf184c2dd5040612187812053d9aa140aa0cda96 100644 (file)
@@ -84,6 +84,14 @@ class CRM_Utils_String {
     // CRM-11744
     $name = preg_replace('/[^a-zA-Z0-9]+/', $char, trim($name));
 
+      //var_dump($name);exit;
+
+    //If there are no ascii characters present.
+    if ($name == $char) {
+      $name = self::createRandom($len, self::ALPHANUMERIC);
+    }
+
+
     if ($len) {
       // lets keep variable names short
       return substr($name, 0, $len);