Fatal error if query contains whitespace and hyphen

Created on 8 May 2023, over 1 year ago
Updated 27 August 2024, 3 months ago

Problem/Motivation

I got this error:

The website encountered an unexpected error. Please try again later.
TypeError: Drupal\search_api_page\Controller\SearchApiPageController::finishBuildWithoutResults(): Argument #2 ($result) must be of type Drupal\search_api\Query\ResultSetInterface, null given, called in /app/web/modules/contrib/search_api_page/src/Controller/SearchApiPageController.php on line 125 in Drupal\search_api_page\Controller\SearchApiPageController->finishBuildWithoutResults() (line 300 of modules/contrib/search_api_page/src/Controller/SearchApiPageController.php).

Steps to reproduce

Search query contains a " -" character set (whitespace and hyphen), although hyphen is added to ignored chars for search index. Not sure here.
My config(patch from comment #9 β†’ from #3108496 β†’ is applied):

Proposed resolution

Add a default NULL value for $result parameter in finishBuildWithoutResults method.

Remaining tasks

Review the patch.

User interface changes

None.

API changes

None.

Data model changes

None.

πŸ› Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡¦πŸ‡ΉAustria granik Vienna

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024