diff options
author | Andreas Gohr <andi@splitbrain.org> | 2011-03-05 16:20:05 +0100 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2011-03-05 16:20:46 +0100 |
commit | 24a6c2354089305a4146c7f8802887aa895c2bd3 (patch) | |
tree | e23e7f1bc5a1cb4ce79087bfcfd64e07a293ff2e | |
parent | 33c7f9a3da533668d21db2e26f776bd854ae81fa (diff) | |
download | rpg-24a6c2354089305a4146c7f8802887aa895c2bd3.tar.gz rpg-24a6c2354089305a4146c7f8802887aa895c2bd3.tar.bz2 |
avoid broken page on bad non-UTF8 highlight string
-rw-r--r-- | inc/html.php | 3 |
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; } |