Problem/Motivation
Since updating to version 3.0.1, some views are encountering an exception that traces back to ViewsQueryAlter::alterQueryForEntityType.
TypeError: Unsupported operand types: string + int in Drupal\trash\ViewsQueryAlter->alterQueryForEntityType() (line 143 of modules/contrib/trash/src/ViewsQueryAlter.php)
Proposed resolution
In #3415216: Trash shouldn't add "or" filter to the first views filter group, the views query was adjusted so that instead of assuming the WHERE clause should always be added to group 1, it's always made the last group.
However, the array keys for groups can often be strings. In fact, the default value is '1' (1 as a string) -- see \Drupal\views\Plugin\views\filter\FilterPluginBase::defineOptions. So adding 1 to the last group number is subject to a TypeError.
Comments
Comment #2
mediabounds commentedI believe the fix is as simple as casting the group number to an
int. Patch attached.Comment #4
amateescu commentedCommitted to 3.x, thanks!