Skip to content

Commit c36f29b

Browse files
committed
Use new array with quoted words to prevent recurrsive adding of escape symbols
1 parent b21693a commit c36f29b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

app/code/Magento/Search/Model/SynonymAnalyzer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,10 @@ private function getSearchPattern(array $words): string
137137
{
138138
$patterns = [];
139139
for ($lastItem = count($words); $lastItem > 0; $lastItem--) {
140-
$words = array_map(function ($word) {
141-
return preg_quote(stripslashes($word), '/');
140+
$safeRegexWords = array_map(function ($word) {
141+
return preg_quote($word, '/');
142142
}, $words);
143-
$phrase = implode("\s+", \array_slice($words, 0, $lastItem));
143+
$phrase = implode("\s+", \array_slice($safeRegexWords, 0, $lastItem));
144144
$patterns[] = '^' . $phrase . ',';
145145
$patterns[] = ',' . $phrase . ',';
146146
$patterns[] = ',' . $phrase . '$';

0 commit comments

Comments
 (0)