I have an error - Error running search_api_cron: TypeError: count(): Argument #1 ($value) must be of type Countable|array, bool given in search_api/includes/processor_tokenizer.inc:85

Comments

AstonVictor created an issue. See original summary.

astonvictor’s picture

Status: Active » Needs review
StatusFileSize
new556 bytes

implemented a small fix

astonvictor’s picture

drunken monkey’s picture

Component: General code » Plugins
StatusFileSize
new796 bytes

Thanks for reporting this problem!
If $arr is a boolean on that line, then it is FALSE because the preg_split() in the line above it failed. This usually means that the regular expression is broken, or too complex for the given input. Do you have some especially complex regular expression configured in the processor’s “Whitespace characters” setting?

This error would indeed be easy to fix, but indexing might still not work as expected for you, at least for some items, so it would be good not to just mask this error here but to address the underlying cause.
At the very least, we should log a warning if this happens. Patch attached, please test/review.

benstallings’s picture

Status: Needs review » Closed (outdated)

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.