- Status changed to Postponed: needs info
over 1 year ago 12:11pm 23 February 2023 I think we are seeking precise reproduction steps. Those belong in the issue summary.
- 🇳🇱Netherlands Marceldeb
Subscribing. Having the same issue.
i also upgraded the Drupal version and php version (from 7.x to 8.x). Currently on Drupal 9.5 and still having the issue.
On my site only the REST Export view type seems to be affected.
- 🇳🇱Netherlands Marceldeb
I could not reproduce this issue but i would like to share a fix. Apparently something in the database is not correct in some of the views / displays.
How to fix:
319 of core/modules/views/src/Plugin/views/query/Sql.php:
$form['query_tags'] = [ '#type' => 'textfield', '#title' => $this->t('Query Tags'), '#description' => $this->t('If set, these tags will be appended to the query and can be used to identify the query in a module. This can be helpful for altering queries.'), '#default_value' => implode(', ', $this->options['query_tags']), '#element_validate' => ['views_element_validate_tags'], ];
Then remove the following line:
'#default_value' => implode(', ', $this->options['query_tags']),
Open your display / view. Open the query settings. Re-save the view.
Now restore the 319 of core/modules/views/src/Plugin/views/query/Sql.php back to original state.
My guess is that for some reason $this->options['query_tags'] sometimes returns a string. Which is strange because in my case the value was empty. Maybe something old in the database? Who knows. I did a check using kint($this->options['query_tags']) and the value was empty / null.
Anyway, i did not see any bug in the Drupal code.
- 🇳🇱Netherlands Marceldeb
I checked my config to see what changed after my above fix. It seems that the query tags were first saved as object in the database, and now as an null.
So the bug is in the Drupal config which changed..and probably during upgrades core devs forgot to handle this.
See image.
- 🇺🇸United States xeiro
I can confirm the same issue as @Marceldeb. Steps to reproduce were making a switch from Other>Caching>"Tag based" to "None". Then switching back to "Tag based". After those two changes, the query errors out when trying to access Query.
Error:
implode(): Argument #1 ($pieces) must be of type array, string given in implode() (line 319 of /code/web/core/modules/views/src/Plugin/views/query/Sql.php)
- 🇧🇪Belgium DuneBL
I got the same issue... could not find the steps to reproduce.
As a quick dirty fix, I have changed line 320 ofweb/core/modules/views/src/Plugin/views/query/Sql.php
into
'#default_value' => isset($this->options['query_tags']) ? implode(', ', $this->options['query_tags']) : NULL,