Skip to content

Search input crashes when including [ due to unescaped regex #210

Description

@Arno2005

Issue

When using the search functionality on the /posts page, if the input contains the character [, the following error occurs:

Warning:
preg_match(): Compilation failed: missing terminating ] for character class at offset 7

Cause
The regex used for searching does not properly escape special characters like [ before applying preg_match().

Expected Behavior

The search should handle special characters safely and not cause a regex compilation error.

Steps to Reproduce

Go to the /posts page.
Enter a search query that includes [ (e.g., [test).
Observe the error message.

Suggested Fix

Ensure that special characters like [ are properly escaped before passing them to preg_match(). Using preg_quote() in PHP can help prevent this issue.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Fields

No fields configured for Bug.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions