diff options
author | Jonas <jonas@freesources.org> | 2022-06-28 15:27:09 +0100 |
---|---|---|
committer | Jonas (Rebase PR Action) <jonas@freesources.org> | 2022-06-30 12:24:42 +0000 |
commit | 7ee01a07fdc93637cc3017bda162dce0d6301f08 (patch) | |
tree | ddd61b6d242ccbff384dcae9150a0b8c0eb3692b | |
parent | 26a4435f84b2ac1c3145a3931936ce5705ea346f (diff) | |
download | nextcloud-server-7ee01a07fdc93637cc3017bda162dce0d6301f08.tar.gz nextcloud-server-7ee01a07fdc93637cc3017bda162dce0d6301f08.zip |
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 <jonas@freesources.org>
-rw-r--r-- | lib/private/Files/Cache/Cache.php | 2 |
1 files changed, 1 insertions, 1 deletions
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()); |