From: Evan Prodromou Date: Fri, 18 Jul 2008 18:35:34 +0000 (-0400) Subject: quote match terms X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=7853df51cec346ac2479cb25d5224b6ad69135c8;p=quix0rs-gnu-social.git quote match terms darcs-hash:20080718183534-84dde-a8cdb4cbcb3eb67152eb74179e3b00061e2287cf.gz --- diff --git a/actions/peoplesearch.php b/actions/peoplesearch.php index 323065d7a9..f700cf46e7 100644 --- a/actions/peoplesearch.php +++ b/actions/peoplesearch.php @@ -115,7 +115,8 @@ class PeoplesearchAction extends SearchAction { } function highlight($text, $terms) { - $pattern = '/('.implode('|',array_map('htmlspecialchars', $terms)).')/i'; + $terms = array_map('preg_quote', array_map('htmlspecialchars', $terms)); + $pattern = '/('.implode('|',$terms).')/i'; $result = preg_replace($pattern, '\\1', htmlspecialchars($text)); return $result; }