Empty contextual filter values break autocomplete

Created on 9 November 2017, over 6 years ago
Updated 11 March 2024, 4 months ago

If the view using an autocomplete field has contextual filters, Views Autocomplete Filters attempts to set their values before returning any autocomplete results. Filter values are taken from the autocomplete URL, where they appear as a string in which individual values are separated with '||'. This string is passed through PHP's explode() and given to ViewExecutable::setArguments().

If any filter value happens to be empty, an empty string ('') gets passed to setArguments. This results in a faulty query, e.g. WHERE fieldname = "" or WHERE fieldname IN(), and no results are returned. To prevent this and make Views bypass the empty argument, any empty values must be set to NULL.

Patch attached.

🐛 Bug report
Status

Closed: duplicate

Version

2.0

Component

Code

Created by

🇫🇮Finland ataimist

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024