Bookmark#toArray: Correctly apply array_unique

fixes #1292

Signed-off-by: Marcel Klehr <mklehr@gmx.net>
This commit is contained in:
Marcel Klehr 2020-11-03 17:22:59 +01:00
parent 76427606f5
commit 672262e92e
1 changed files with 3 additions and 3 deletions

View File

@ -24,16 +24,16 @@ class BookmarkWithTagsAndParent extends Bookmark {
$array = [];
foreach (self::$fields as $field) {
if ($field === 'tags' && is_string($this->{$field})) {
$array[$field] = $this->{$field} === ''? [] : array_unique(explode(',',$this->{$field}));
$array[$field] = $this->{$field} === ''? [] : array_values(array_unique(explode(',',$this->{$field})));
continue;
}
if ($field === 'folders') {
if ($this->{$field} === '') {
$array[$field] = [];
} else {
$array[$field] = array_unique(array_map(static function ($id) {
$array[$field] = array_values(array_unique(array_map(static function ($id) {
return (int) $id;
},explode(',',$this->{$field})));
},explode(',',$this->{$field}))));
}
continue;
}