From: moodler Date: Sat, 13 Dec 2003 06:27:25 +0000 (+0000) Subject: Prevent funny-looking text when trying to highlight a null string X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=69d51d3a81077c0c78e2b8d9a56c8d6f146e8939;p=moodle.git Prevent funny-looking text when trying to highlight a null string --- diff --git a/lib/weblib.php b/lib/weblib.php index d024e81924..1530c19f27 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -717,6 +717,10 @@ function highlight($needle, $haystack, $case=0, /// this function after performing any conversions to HTML. /// Function found here: http://forums.devshed.com/t67822/scdaa2d1c3d4bacb4671d075ad41f0854.html + if (empty($needle)) { + return $haystack; + } + $list_of_words = eregi_replace("[^-a-zA-Z0-9&']", " ", $needle); $list_array = explode(" ", $list_of_words); for ($i=0; $i