Receiving a TypeError in Trash 3.0.1

Created on 30 January 2024, 10 months ago
Updated 16 February 2024, 9 months ago

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 πŸ› Trash shouldn't add "or" filter to the first views filter group Fixed , 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.

πŸ› Bug report
Status

Fixed

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States mediabounds

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024