diff options
author | D Low <daniellowtw@gmail.com> | 2016-04-14 00:04:00 +0100 |
---|---|---|
committer | D Low <daniellowtw@gmail.com> | 2016-04-14 00:10:39 +0100 |
commit | 20f89623c01696a05459c4b1191cfe3adfb0105b (patch) | |
tree | a9ae52c01f411f60ffe642d23f4a75cf2eb8a54c /application | |
parent | 9f400b0dad68b82d65692bd6ab6190f6a787fa89 (diff) | |
download | Shaarli-20f89623c01696a05459c4b1191cfe3adfb0105b.tar.gz Shaarli-20f89623c01696a05459c4b1191cfe3adfb0105b.tar.zst Shaarli-20f89623c01696a05459c4b1191cfe3adfb0105b.zip |
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].
Diffstat (limited to 'application')
-rw-r--r-- | application/LinkFilter.php | 2 |
1 files changed, 1 insertions, 1 deletions
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 @@ class LinkFilter | |||
322 | $tagsOut = $casesensitive ? $tags : mb_convert_case($tags, MB_CASE_LOWER, 'UTF-8'); | 322 | $tagsOut = $casesensitive ? $tags : mb_convert_case($tags, MB_CASE_LOWER, 'UTF-8'); |
323 | $tagsOut = str_replace(',', ' ', $tagsOut); | 323 | $tagsOut = str_replace(',', ' ', $tagsOut); |
324 | 324 | ||
325 | return array_filter(explode(' ', trim($tagsOut)), 'strlen'); | 325 | return array_values(array_filter(explode(' ', trim($tagsOut)), 'strlen')); |
326 | } | 326 | } |
327 | } | 327 | } |
328 | 328 | ||