summaryrefslogtreecommitdiff
path: root/inc/html.php
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2011-03-05 16:20:05 +0100
committerAndreas Gohr <andi@splitbrain.org>2011-03-05 16:20:46 +0100
commit24a6c2354089305a4146c7f8802887aa895c2bd3 (patch)
treee23e7f1bc5a1cb4ce79087bfcfd64e07a293ff2e /inc/html.php
parent33c7f9a3da533668d21db2e26f776bd854ae81fa (diff)
downloadrpg-24a6c2354089305a4146c7f8802887aa895c2bd3.tar.gz
rpg-24a6c2354089305a4146c7f8802887aa895c2bd3.tar.bz2
avoid broken page on bad non-UTF8 highlight string
Diffstat (limited to 'inc/html.php')
-rw-r--r--inc/html.php3
1 files changed, 2 insertions, 1 deletions
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;
}