Accent variations creating invalid regular expression?
-
Hi,
I have been using Relevanssi without problems for years (10 maybe?) Since I recently upgraded WordPress and Relevanssi I have started getting “compilation failed” error warnings. This seems to be happening in
relevanssi_add_accent_variations
.Example:
PHP Warning: preg_replace(): Compilation failed: missing ) at offset 57 in [...]/wp-content/plugins/relevanssi/lib/excerpts-highlights.php on line 490 PHP Warning: preg_replace(): Compilation failed: unmatched parentheses at offset 39 in [...]/wp-content/plugins/relevanssi/lib/excerpts-highlights.php on line 490
I added some logging in excerpts-highlights.php to see what transformations are happening to the term. It looks like an initially quoted
)
in the search term is getting unquoted when adding accent variations. For example, I searched fortest)
.initial term: test), referer: https://[...]/?s=test quoted term: test\\), referer: https://[...]/?s=test with accent variations: t-?(e|\xc3\xa9|\xc3\xa8|\xc3\xaa|\xc3\xab)-?s-?t-?\\-?), referer: https://[...]/?s=test PHP Warning: preg_replace(): Compilation failed: unmatched parentheses at offset 31 in [...]/wp-content/plugins/relevanssi/lib/excerpts-highlights.php on line 492, referer: https://[...]/?s=test
Something similar happens when searching for
test[
.initial term: test[, referer: https://[...]/?s=test%5D quoted term: test\\[, referer: https://[...]/?s=test%5D with accent variations: t-?(e|\xc3\xa9|\xc3\xa8|\xc3\xaa|\xc3\xab)-?s-?t-?\\-?[, referer: https://[...]/?s=test%5D PHP Warning: preg_replace(): Compilation failed: missing terminating ] for character class at offset 32 in [...]/wp-content/plugins/relevanssi/lib/excerpts-highlights.php on line 492, referer: https://[...]/?s=test%5D
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Accent variations creating invalid regular expression?’ is closed to new replies.