]> source.dussan.org Git - nextcloud-server.git/commitdiff
Check whether entry is of type ICacheEntry in Cache->remove() 33050/head
authorJonas <jonas@freesources.org>
Tue, 28 Jun 2022 14:27:09 +0000 (15:27 +0100)
committerJonas (Rebase PR Action) <jonas@freesources.org>
Wed, 29 Jun 2022 10:47:07 +0000 (10:47 +0000)
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>
lib/private/Files/Cache/Cache.php

index c6cadf14f86fd69b39bae86041bf18b24a67f9d3..33a07e9b9e56db5d83f9e7e21ba2ccd90b8000de 100644 (file)
@@ -540,7 +540,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());