From: Christoph Wurst Date: Fri, 11 Sep 2020 13:57:04 +0000 (+0200) Subject: Fix serializing indexed unified search array as object X-Git-Tag: v20.0.0RC1~41^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0022b63fe88235d66e58f233a8ee61cc2618084c;p=nextcloud-server.git Fix serializing indexed unified search array as object We expect an array of results from the search provider. If the search provider returns an array with indexes, php will serialize it as object, not as array (to preserve the keys). The client doesn't need this info, so we should just discard it and take the values only to always render a JSON array. Signed-off-by: Christoph Wurst --- diff --git a/lib/public/Search/SearchResult.php b/lib/public/Search/SearchResult.php index 1a07f24b33a..e70c70f1aaa 100644 --- a/lib/public/Search/SearchResult.php +++ b/lib/public/Search/SearchResult.php @@ -28,6 +28,7 @@ declare(strict_types=1); namespace OCP\Search; use JsonSerializable; +use function array_values; /** * @since 20.0.0 @@ -107,7 +108,7 @@ final class SearchResult implements JsonSerializable { return [ 'name' => $this->name, 'isPaginated' => $this->isPaginated, - 'entries' => $this->entries, + 'entries' => array_values($this->entries), 'cursor' => $this->cursor, ]; }