aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSem <sembrestels@riseup.net>2012-12-05 01:52:31 +0100
committerSem <sembrestels@riseup.net>2012-12-05 01:52:31 +0100
commit4e20956a31a9392c31953e22c9693578d490ed4a (patch)
treed95027196ce4afdbdd971ef31a6778c8bbdde6c2
parent75d7fd1106dcd97e2a3ccb25bd4df780a66b82dd (diff)
parent01009d63657b76e2df3e03950975de65e5ee9cf0 (diff)
downloadelgg-4e20956a31a9392c31953e22c9693578d490ed4a.tar.gz
elgg-4e20956a31a9392c31953e22c9693578d490ed4a.tar.bz2
Merge branch 'search-warnings' of git://github.com/sembrestels/Elgg into foxglove-1
-rw-r--r--mod/search/start.php4
1 files changed, 3 insertions, 1 deletions
diff --git a/mod/search/start.php b/mod/search/start.php
index d2d7ed3c2..f493508d8 100644
--- a/mod/search/start.php
+++ b/mod/search/start.php
@@ -94,6 +94,8 @@ function search_get_highlighted_relevant_substrings($haystack, $query, $min_matc
if (!$tag_match) {
$words = search_remove_ignored_words($query, 'array');
+ } else {
+ $words = array();
}
// if haystack < $max_length return the entire haystack w/formatting immediately
@@ -142,7 +144,7 @@ function search_get_highlighted_relevant_substrings($haystack, $query, $min_matc
$total_length = array_sum($offsets);
$add_length = 0;
- if ($total_length < $max_length) {
+ if ($total_length < $max_length && $offsets) {
$add_length = floor((($max_length - $total_length) / count($offsets)) / 2);
$starts = array();