Merge pull request #19307 from eileenmcnaughton/534
[civicrm-core.git] / api / v3 / Generic.php
index fe355becf2f93594c0689c10d4bf4bca6977e9d8..0eef89a7a2f6114876af58579cf4df0607e48c75 100644 (file)
@@ -406,6 +406,7 @@ function civicrm_api3_generic_replace($apiRequest) {
  *
  * @return array
  *   Array of results
+ * @throws \CiviCRM_API3_Exception
  */
 function civicrm_api3_generic_getoptions($apiRequest) {
   // Resolve aliases.
@@ -513,7 +514,7 @@ function _civicrm_api3_generic_get_metadata_options(&$metadata, $apiRequest, $fi
   }
 
   $options = civicrm_api($apiRequest['entity'], 'getoptions', ['version' => 3, 'field' => $fieldname, 'context' => $context]);
-  if (is_array(CRM_Utils_Array::value('values', $options))) {
+  if (isset($options['values']) && is_array($options['values'])) {
     $metadata[$fieldname]['options'] = $options['values'];
   }
 }