From: Seamus Lee Date: Wed, 30 Jun 2021 22:02:53 +0000 (+0000) Subject: [REF] Fix trying to access array offset from boolean value X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=08fd12e290680c59397be070f0394d809bf78601;p=civicrm-core.git [REF] Fix trying to access array offset from boolean value --- diff --git a/Civi/Api4/Query/Api4SelectQuery.php b/Civi/Api4/Query/Api4SelectQuery.php index b84a717797..4136698f13 100644 --- a/Civi/Api4/Query/Api4SelectQuery.php +++ b/Civi/Api4/Query/Api4SelectQuery.php @@ -271,7 +271,7 @@ class Api4SelectQuery { private function selectMatchingFields($pattern) { // Only core & custom fields can be selected $availableFields = array_filter($this->apiFieldSpec, function($field) { - return in_array($field['type'], ['Field', 'Custom'], TRUE); + return is_array($field) && in_array($field['type'], ['Field', 'Custom'], TRUE); }); return SelectUtil::getMatchingFields($pattern, array_keys($availableFields)); } @@ -752,7 +752,7 @@ class Api4SelectQuery { // If we're not explicitly referencing the ID (or some other FK field) of the joinEntity, search for a default if (!$explicitFK) { foreach ($this->apiFieldSpec as $name => $field) { - if ($field['entity'] !== $joinEntity && $field['fk_entity'] === $joinEntity) { + if (is_array($field) && $field['entity'] !== $joinEntity && $field['fk_entity'] === $joinEntity) { $conditions[] = $this->treeWalkClauses([$name, '=', "$alias.id"], 'ON'); } elseif (strpos($name, "$alias.") === 0 && substr_count($name, '.') === 1 && $field['fk_entity'] === $this->getEntity()) {