From 08fd12e290680c59397be070f0394d809bf78601 Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Wed, 30 Jun 2021 22:02:53 +0000 Subject: [PATCH] [REF] Fix trying to access array offset from boolean value --- Civi/Api4/Query/Api4SelectQuery.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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()) { -- 2.25.1