We were facing this issue when working on our search view, it's a simple view with only one field exposed for searching in diferent fields of indexed content.
Steps to reproduce: Add a exposed field on a view of type "Fulltext Search", then search for any string.
Here's the full warning:
Warning: array_intersect(): Expected parameter 2 to be an array, string given in Drupal\search_api\Plugin\views\filter\SearchApiFulltext->query() (line 381 of modules/contrib/search_api/src/Plugin/views/filter/SearchApiFulltext.php).
Drupal\search_api\Plugin\views\filter\SearchApiFulltext->query() (Line: 1373)
Drupal\views\ViewExecutable->_build('filter') (Line: 1262)
Drupal\views\ViewExecutable->build() (Line: 390)
I've made a patch that should ignore this warning, as its just a Warning it does not break the functionality.
Comments
Comment #2
yuri morato duarte commentedAdded patch
Comment #3
yuri morato duarte commentedComment #4
drunken monkeyThanks for reporting this issue.
I can, however, assure you 100% that your steps to reproduce are not sufficient to reproduce the issue. A “Search: Fulltext search“ exposed filter is probably used by 100,000 websites world-wide, and no-one has yet reported this problem. I, too, could not reproduce it.
Could you tell me whether you enabled the “Expose searched fields” option for the filter, and what other form input fields your exposed form contains? Also, what’s the (non-array) value of
$this->searchedFieldsthere?In any case, I do now see that we (for some reason) ignore the “Expose searched fields” option when collecting the searched fields, so there is the theoretical potential for a bug in case a form field’s ID matches the “Expose searched fields” input ID by coincidence. Maybe that’s what’s happening for you.
Please test whether the attached patch fixes the problem for you.
Comment #6
drunken monkeySince I think this patch is an improvement regardless, I now committed it.
Please re-open the issue if the problem remains, with more input.
Comment #8
yuri morato duarte commentedHi I completely forgot to answer you, but the patch did solve my issue. Thanks!