Problem/Motivation
There are two problems here, both of them in Drupal\Core\Config\Entity\Query\Condition.php.
This occurs under the condition that there are array values stored for a property in a config entity. In order to match the comparison correctly, the entity query system needs modification.
- There's a conversion to lower case that fails since it can't take an array as input.
- There's no comparison of a single value against an array value. The opposite exists, there a comparison with
$condition['value']
, but it matches the opposite, comparing an array in the condition with a mixed value in entity config.
The error given is:TypeError: mb_strtolower(): Argument #1 ($string) must be of type string, array given in mb_strtolower() (line 174 of core/lib/Drupal/Core/Config/Entity/Query/Condition.php). Drupal\Core\Config\Entity\Query\Condition->match(Array, Array) (Line: 145)
Steps to reproduce
- Install webform and import the sample form attached, notice there are two categories present in the config.
- Set up a module that extracts entities from webform, filtered by the presence of a category. Sample code is given below.
Comparison code:
$webforms = \Drupal::entityQuery('webform')
->accessCheck(FALSE)
->condition('categories', 'sample_category_1')
->execute();
Proposed resolution
When there's a match against the array value in entity config, the entityQuery should return all matching entities.
Remaining tasks
User interface changes
None
API changes
None
Data model changes
None