From: Seamus Lee Date: Fri, 4 Jun 2021 22:38:55 +0000 (+0000) Subject: [php8-compat] Fix issue in APIv3 Where by because product has a column called options... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=cd72683b6747c099858ca1b72fb2ae859dfcbe45;p=civicrm-core.git [php8-compat] Fix issue in APIv3 Where by because product has a column called options the testCreateSingleValueAlter triggers a cannot access offset of type string on string in php8 --- diff --git a/api/v3/Generic.php b/api/v3/Generic.php index 586d34f5b9..9a55547607 100644 --- a/api/v3/Generic.php +++ b/api/v3/Generic.php @@ -511,7 +511,12 @@ function _civicrm_api3_generic_get_metadata_options(&$metadata, $apiRequest, $fi return; } - $fieldsToResolve = $apiRequest['params']['options']['get_options']; + if (!is_array($apiRequest['params']['options'])) { + $fieldsToResolve = []; + } + else { + $fieldsToResolve = $apiRequest['params']['options']['get_options']; + } if (!empty($metadata[$fieldname]['options']) || (!in_array($fieldname, $fieldsToResolve) && !in_array('all', $fieldsToResolve))) { return;