From 24a6c2354089305a4146c7f8802887aa895c2bd3 Mon Sep 17 00:00:00 2001 From: Andreas Gohr <andi@splitbrain.org> Date: Sat, 5 Mar 2011 16:20:05 +0100 Subject: [PATCH] avoid broken page on bad non-UTF8 highlight string --- inc/html.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/inc/html.php b/inc/html.php index 080beb01a..fcfa54b6c 100644 --- a/inc/html.php +++ b/inc/html.php @@ -284,7 +284,8 @@ function html_hilight($html,$phrases){ $regex = join('|',array_map('ft_snippet_re_preprocess', array_map('preg_quote_cb',$phrases))); if ($regex === '') return $html; - $html = preg_replace_callback("/((<[^>]*)|$regex)/ui",'html_hilight_callback',$html); + if (!utf8_check($regex)) return $html; + $html = @preg_replace_callback("/((<[^>]*)|$regex)/ui",'html_hilight_callback',$html); return $html; } -- GitLab