Don't let optiongroup check crash
authorMatthew Wire (MJW Consulting) <mjw@mjwconsult.co.uk>
Sat, 27 Jul 2019 19:49:38 +0000 (20:49 +0100)
committerMatthew Wire (MJW Consulting) <mjw@mjwconsult.co.uk>
Sat, 27 Jul 2019 19:49:38 +0000 (20:49 +0100)
CRM/Utils/Check/Component/OptionGroups.php

index dda6660290f121a43f35cca53ef74e530cd38c62..33abe22786334a1460068e30881f78c8949c8cc7 100644 (file)
@@ -48,8 +48,10 @@ class CRM_Utils_Check_Component_OptionGroups extends CRM_Utils_Check_Component {
         $values = CRM_Core_BAO_OptionValue::getOptionValuesArray($optionGroup['id']);
         if (count($values) > 0) {
           foreach ($values as $value) {
-            $validate = CRM_Utils_Type::validate($value['value'], $optionGroup['data_type'], FALSE);
-            if (is_null($validate)) {
+            try {
+              CRM_Utils_Type::validate($value['value'], $optionGroup['data_type'], FALSE, '', TRUE);
+            }
+            catch (Exception $e) {
               $problemValues[] = [
                 'group_name' => $optionGroup['title'],
                 'value_name' => $value['label'],