Skip to content

Commit

Permalink
Merge pull request #20734 from seamuslee001/fix_patch_php8
Browse files Browse the repository at this point in the history
[REF] Fix trying to access array offset from boolean value
  • Loading branch information
colemanw authored Jul 1, 2021
2 parents 5bd3a3f + 08fd12e commit 5e0e94e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Civi/Api4/Query/Api4SelectQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ protected function buildSelectClause($select = NULL) {
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));
}
Expand Down Expand Up @@ -752,7 +752,7 @@ private function getJoinConditions($joinTree, $joinEntity, $alias, $joinEntityFi
// 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()) {
Expand Down

0 comments on commit 5e0e94e

Please sign in to comment.