Problem/Motivation

The module tries to find out whether any filter (normal or conditional filter) filters by any delete column. In case it does opt out of adding a specific delete column.

To do so it loops over all conditions in the current views query and compares the name of the conditions field with the name of the deleted column/table. See line 141 of ViewsQueryAlter.php.
Unfortunately the field is not always a string but may also be a ConditionInterface. This leads to the error:
TypeError: strpos(): Argument #1 ($haystack) must be of type string, Drupal\Core\Database\Query\Condition given in strpos() (line 141 of modules/contrib/trash/src/ViewsQueryAlter.php).

Steps to reproduce

Add a custom query alter to the views query and add a query condition for a field.

Proposed resolution

Test if $condition['field'] is a string before using strpos().

Remaining tasks

User interface changes

API changes

Data model changes

Issue fork trash-3507125

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

stborchert created an issue. See original summary.

stborchert’s picture

Status: Active » Needs review

I've added the string check for the condition field.

amateescu made their first commit to this issue’s fork.

  • amateescu committed 48fc6c0c on 3.x authored by stborchert
    Issue #3507125: TypeError: strpos(): Argument #1 ($haystack) must be of...
amateescu’s picture

Status: Needs review » Fixed

Looks great, thanks! Merged into 3.x.

stborchert’s picture

Wow, that was fast. Thank you.

phenaproxima’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.