From 7ee01a07fdc93637cc3017bda162dce0d6301f08 Mon Sep 17 00:00:00 2001 From: Jonas Date: Tue, 28 Jun 2022 15:27:09 +0100 Subject: Check whether entry is of type ICacheEntry in Cache->remove() In some scenarios (file not in cache, but partial data of it in the object), Cache->get() might return an array, which leads to errors like "Call to a member function getId() on array". So check whether the returned entry is of type ICacheEntry before doing operations on it in Cache->remove(). Fixes: #33023 Signed-off-by: Jonas --- lib/private/Files/Cache/Cache.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/private/Files/Cache/Cache.php b/lib/private/Files/Cache/Cache.php index dc2ba78457e..dc5a6cc0a9f 100644 --- a/lib/private/Files/Cache/Cache.php +++ b/lib/private/Files/Cache/Cache.php @@ -537,7 +537,7 @@ class Cache implements ICache { public function remove($file) { $entry = $this->get($file); - if ($entry) { + if ($entry instanceof ICacheEntry) { $query = $this->getQueryBuilder(); $query->delete('filecache') ->whereFileId($entry->getId()); -- cgit v1.2.3