Fix variable type for array_flip instruction

This commit is contained in:
Jose Gonzalez 2020-09-07 14:13:53 +02:00
parent 42a615166e
commit aecbab5c36
1 changed files with 7 additions and 1 deletions

View File

@ -1042,7 +1042,13 @@ function events_get_all(
$tags = json_decode($tag_with, true); $tags = json_decode($tag_with, true);
if (is_array($tags) && !in_array('0', $tags)) { if (is_array($tags) && !in_array('0', $tags)) {
if (!$user_is_admin) { if (!$user_is_admin) {
$user_tags = array_flip(tags_get_tags_for_module_search()); $getUserTags = tags_get_tags_for_module_search();
// Prevent false value for array_flip
if ($getUserTags === false) {
$getUserTags = [];
}
$user_tags = array_flip($getUserTags);
if ($user_tags != null) { if ($user_tags != null) {
foreach ($tags as $id_tag) { foreach ($tags as $id_tag) {
// User cannot filter with those tags. // User cannot filter with those tags.