Epic #65814: Make Indexed search extbase plugin shine
Indexed Search: errors in experimental mode when searching for empty string
When searching for an empty string in experimental mode several warnings like
"Core: Error handler (FE): PHP Warning: Invalid argument supplied for foreach()"
appear in the log.
Sometimes (I think the first time searching for an empty string after flushing the caches) it even results in a php-error like
"Core: Exception handler (WEB): Uncaught TYPO3 Exception: #1237900529: The argument "each" was registered with type "array", but is of type "boolean" in view helper "TYPO3\CMS\Fluid\ViewHelpers\ForViewHelper""
The reason for this is the return value of the function "getSearchWords" in the file SearchController.php,
which is "FALSE" instead of an array.
I can think of two possible solutions of this problem:
initializing "$sWordArray" as an empty array instead of "FALSE",
or checking whether it is an Array at the end of the function and setting it as an array if it isnt.
[BUGFIX] Indexed Search: Fix warning for empty search word
The Extbase plugin throws a warning when the search word is empty.
This was already fixed in a bigger change in v7, which can not be
easily backported. This is a simple fix for v6.
Reviewed-by: Daniel Goerz <email@example.com>
Tested-by: Daniel Goerz <firstname.lastname@example.org>
Reviewed-by: Markus Klein <email@example.com>
Tested-by: Markus Klein <firstname.lastname@example.org>