From 755a3caf2918dcd11a1b0a8fd492b4c4a942b026 Mon Sep 17 00:00:00 2001 From: Arthur Almeida Date: Thu, 11 May 2017 11:53:55 -0300 Subject: [PATCH] CRM-20508 - fixed creating custom fields when all chars are non-ascii on Label field --- CRM/Utils/String.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CRM/Utils/String.php b/CRM/Utils/String.php index 5fdeb91b75..cf184c2dd5 100644 --- a/CRM/Utils/String.php +++ b/CRM/Utils/String.php @@ -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); -- 2.25.1