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.
Issue
When using the search functionality on the
/postspage, if the input contains the character[, the following error occurs: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
/postspage.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 topreg_match(). Usingpreg_quote()in PHP can help prevent this issue.