Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas <jonas@freesources.org>2022-06-28 17:27:09 +0300
committerJonas (Rebase PR Action) <jonas@freesources.org>2022-06-30 15:24:42 +0300
commit7ee01a07fdc93637cc3017bda162dce0d6301f08 (patch)
treeddd61b6d242ccbff384dcae9150a0b8c0eb3692b
parent26a4435f84b2ac1c3145a3931936ce5705ea346f (diff)
Check whether entry is of type ICacheEntry in Cache->remove()backport/33050/stable23
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.php2
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());