In the 'Highlighting' processor, the search keys are not escaped for special characters. This can break the regular expression.

An example query that is not properly escaped: 'drupal + search_api'

Comments

idebr’s picture

Status: Active » Needs review
StatusFileSize
new840 bytes

Attached patch preg_quotes the search keys before the keys are inserted into the regular expression

idebr’s picture

Issue summary: View changes
idebr’s picture

Issue summary: View changes
drunken monkey’s picture

StatusFileSize
new777 bytes

Ah, you're right! Thanks for spotting this and providing a fix! Don't know how that slipped past me, with regular expressions I'm normally extra-careful …
Anyways, I think the attached form of the patch is more readable, the foreach loop can easily be replaced by a array_map() call.

drunken monkey’s picture

Component: Framework » Plugins
idebr’s picture

Yes, that is definitely better than #1. Simple and elegant, I like it!

drunken monkey’s picture

Status: Needs review » Fixed

Excellent, good to hear!
Committed.
Thanks again for your contribution!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.