From d98b091cc525fc09d01b22f61f3911539af6c118 Mon Sep 17 00:00:00 2001 From: colemanw Date: Mon, 26 Jun 2017 17:09:32 -0400 Subject: [PATCH] Better numeric check --- CRM/Price/Form/Set.php | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/CRM/Price/Form/Set.php b/CRM/Price/Form/Set.php index 6ab31472ac..c6c17e5efb 100644 --- a/CRM/Price/Form/Set.php +++ b/CRM/Price/Form/Set.php @@ -95,14 +95,9 @@ class CRM_Price_Form_Set extends CRM_Core_Form { $errors['extends'] = ts('If you plan on using this price set for membership signup and renewal, you can not also use it for Events or Contributions. However, a membership price set may include additional fields for non-membership options that require an additional fee (e.g. magazine subscription).'); } } - //checks the given price set doesnot start with digit - $title = $fields['title']; - if ($title) { - // gives the ascii value - $asciiValue = ord($title{0}); - if ($asciiValue >= 48 && $asciiValue <= 57) { - $errors['title'] = ts("Name cannot not start with a digit"); - } + // Checks the given price set does not start with a digit + if (strlen($fields['title']) && is_numeric($fields['title'][0])) { + $errors['title'] = ts("Name cannot not start with a digit"); } return empty($errors) ? TRUE : $errors; } -- 2.25.1