Skip to content

Commit

Permalink
Quote highlight word
Browse files Browse the repository at this point in the history
  • Loading branch information
nadar authored Nov 22, 2018
1 parent db11e8a commit 7c5fb48
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/helpers/StringHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ public static function highlightWord($content, $word, $markup = '<b>%s</b>')
$content = strip_tags($content);
$latest = null;
foreach ($word as $needle) {
preg_match_all("/$needle+/i", $content, $matches);
preg_match_all("/".preg_quote($needle)."+/i", $content, $matches);
if (is_array($matches[0]) && count($matches[0]) >= 1) {
foreach ($matches[0] as $match) {
// ensure if a word is found twice we don't replace again.
Expand Down

0 comments on commit 7c5fb48

Please sign in to comment.