Skip to content

[ticket/17614] Remove invalid syntax from sphinx search queries#6989

Open
ECYaz wants to merge 1 commit into
phpbb:masterfrom
ECYaz:ticket/17614-master
Open

[ticket/17614] Remove invalid syntax from sphinx search queries#6989
ECYaz wants to merge 1 commit into
phpbb:masterfrom
ECYaz:ticket/17614-master

Conversation

@ECYaz

@ECYaz ECYaz commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Checklist:

Tracker ticket:

https://tracker.phpbb.com/browse/PHPBB-17614

Master version of #6987, since the search backend moved in 4.x and the 3.3.x patch does not apply cleanly there. Same change: unmatched quotation marks and parentheses, empty groups and operators without an operand are removed from the query before it is sent to searchd, while valid syntax such as (either | or) and phrases are preserved. Author searches, which intentionally run with an empty query, are unaffected.

Unmatched parentheses or quotation marks in the keywords, as well as
parenthesized groups and operators left without any search term, made
searchd fail the whole query with a syntax error which was logged and
shown to the user as a general error.

Clean the query in sphinx_clean_search_string() by removing unmatched
quotation marks and parentheses (ignoring those within quotation marks),
term-less groups and operators without an operand, while keeping valid
grouping syntax like (either | or) intact. Skip querying altogether if
no searchable term is left after cleaning, while keeping author-only
searches working as they intentionally run with an empty query.

PHPBB-17614
@ECYaz
ECYaz force-pushed the ticket/17614-master branch from 26c377f to b98892c Compare July 20, 2026 02:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant