diff --git a/core/lib/Drupal/Core/Config/Entity/Query/Query.php b/core/lib/Drupal/Core/Config/Entity/Query/Query.php index 81c3dfb..40144ed 100644 --- a/core/lib/Drupal/Core/Config/Entity/Query/Query.php +++ b/core/lib/Drupal/Core/Config/Entity/Query/Query.php @@ -128,31 +128,37 @@ protected function loadRecords() { $prefix = $entity_info->getConfigPrefix() . '.'; $prefix_length = strlen($prefix); - // If there are conditions on the config ID, we can narrow the list of - // records to load and parse. + // Search the conditions for restrictions on entity IDs. $ids = array(); if ($this->condition->getConjunction() == 'AND') { foreach ($this->condition->conditions() as $condition) { - if ($condition['field'] == $entity_info->getKey('id')) { + if (is_string($condition['field']) && $condition['field'] == $entity_info->getKey('id')) { $operator = $condition['operator'] ?: (is_array($condition['value']) ? 'IN' : '='); - if ($operator == '=' || $operator == 'IN') { - $ids = is_array($condition['value']) ? $condition['value'] : array($condition['value']); - // We can stop at the first condition on ID. In the (weird) case - // where other conditions additionally restrict IDs, results will - // be eliminated when the conditions are checked on the loaded - // records. + if ($operator == '=') { + $ids = array($condition['value']); + } + elseif ($operator == 'IN') { + $ids = $condition['value']; + } + // We stop at the first restricting condition on ID. In the (weird) + // case where there are additional restricting conditions, results + // will be eliminated when the conditions are checked on the loaded + // records. + if ($ids) { break; } } } } + // If there are conditions restricting config ID, we can narrow the list of + // records to load and parse. if ($ids) { $names = array_map(function ($id) use ($prefix) { return $prefix . $id; }, $ids); } + // If no restrictions on IDs were found, we need to parse all records. else { - // If no conditions on IDs were found, we need to parse all records. $names = $this->configStorage->listAll($prefix); }