By larowlan on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
10.1.x
Introduced in version:
10.1.0
Issue links:
Description:
Prior to Drupal 10.1.0, passing an array as the value in a database condition without passing an operator resulted in inconsistent behaviours.
For example
$condition->condition('foobar', [1]);
would work, whilst
$condition->condition('foobar', [1, 2]);
would not.
Starting in Drupal 10.1.0, passing an array for the value with any of the =, >, <, >=, <=, IS NULL or IS NOT NULL operators or no operator will result in an exception.
Impacts:
Module developers
Comments
Something that worked before 11.1.8 but not after
I am not sure where this change happened but it worked before Drupal 11.1.8 and possibly Drupal 11. I got this error and it took me a little to figure it out as I wasn't using an 'IN' operator.
What worked before but doesn't now:
The getValue returns an array which causes the issue. The fix is to just use the getString function instead.
This works:
I hope this helps someone that is scratching their head.