From 20f89623c01696a05459c4b1191cfe3adfb0105b Mon Sep 17 00:00:00 2001 From: D Low Date: Thu, 14 Apr 2016 00:04:00 +0100 Subject: [PATCH] Fix error when filtering search tags Arrays are key-value maps. We should reindex the array after a filter since we are using the key and count to do array access in filterTags. An example would be searching for "foo, bar", after the array filter, our array is actually (0 -> foo, 2 -> bar) which will cause an error when trying to access $searchtags[1]. --- application/LinkFilter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/LinkFilter.php b/application/LinkFilter.php index 5e0d8015..e693b284 100644 --- a/application/LinkFilter.php +++ b/application/LinkFilter.php @@ -322,7 +322,7 @@ public static function tagsStrToArray($tags, $casesensitive) $tagsOut = $casesensitive ? $tags : mb_convert_case($tags, MB_CASE_LOWER, 'UTF-8'); $tagsOut = str_replace(',', ' ', $tagsOut); - return array_filter(explode(' ', trim($tagsOut)), 'strlen'); + return array_values(array_filter(explode(' ', trim($tagsOut)), 'strlen')); } }