Warning: array_filter() expects parameter 1 to be array, bool given in Drupal\search_api\Plugin\search_api\processor\Highlight->getKeywords() (line 398 of /var/www/html/deployments/1574154436/web/modules/contrib/search_api/src/Plugin/search_api/processor/Highlight.php) #0 /var/www/html/deployments/1574154436/web/core/includes/bootstrap.inc(587): _drupal_error_handler_real(2, 'array_filter() ...', '/var/www/html/r...', 398, Array) #1 [internal function]: _drupal_error_handler(2, 'array_filter() ...', '/var/www/html/r...', 398, Array) #2 /var/www/html/deployments/1574154436/web/modules/contrib/search_api/src/Plugin/search_api/processor/Highlight.php(398): array_filter(false) #3 /var/www/html/deployments/1574154436/web/modules/contrib/search_api/src/Plugin/search_api/processor/Highlight.php(240): Drupal\search_api\Plugin\search_api\processor\Highlight->getKeywords(Object(Drupal\search_api\Query\Query)) #4 /var/www/html/deployments/1574154436/web/modules/contrib/search_api/src/Entity/Index.php(675): Drupal\search_api\Plugin\search_api\processor\Highlight->postprocessSearchResults(Object(Drupal\search_api\Query\ResultSet)) #5 /var/www/html/deployments/1574154436/web/modules/contrib/search_api/src/Query/Query.php(606): Drupal\search_api\Entity\Index->postprocessSearchResults(Object(Drupal\search_api\Query\ResultSet)) #6 /var/www/html/deployments/1574154436/web/modules/contrib/search_api/src/Query/Query.php(538): Drupal\search_api\Query\Query-
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | 3096573-3--highlight_preg_fail.patch | 588 bytes | drunken monkey |
Comments
Comment #2
mudassar774 commentedComment #3
drunken monkeyThanks for reporting and already providing a patch!
Please set the status to “Needs review”, though, when posting a patch that works for you. This makes it easier to spot issues with patches.
In any case, I think we can resolve this in a simpler way, without adding another level of nesting – please see (and test) the attached patch.
However, do you have any idea why the
preg_split()would fail in the line above in your case? Does it always do this, or was it a one-time occurrence? Can you reproduce it? Or was there maybe another warning right before the one you posted, telling us whypreg_split()failed?Would be good to know in order to be able to rule out any underlying issues.
Comment #4
drunken monkeyComment #5
mudassar774 commentedHi
Suggested solution looks good.
Unfortunately, I can't reproduce:( The issue was found in my DBLOGS
Comment #7
drunken monkeyOK, thanks for reporting back. If you can’t reproduce yourself that’s a bit unfortunate, of course, but a bit of defensive coding also shouldn’t do any harm.
So, committed.
Thanks again!