diff options
author | Jonas <jonas@freesources.org> | 2022-06-28 17:27:09 +0300 |
---|---|---|
committer | Jonas (Rebase PR Action) <jonas@freesources.org> | 2022-06-30 15:25:26 +0300 |
commit | aec0899efd8157c76dfd401e1a175b12e559710f (patch) | |
tree | 937b2d9e62f7262b02564c7d866b325b82d223bc /lib | |
parent | 47934494f6e17ac4926cb2c0be79e94130f4ed82 (diff) |
Check whether entry is of type ICacheEntry in Cache->remove()backport/33050/stable24
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>
Diffstat (limited to 'lib')
-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 dc6ab6dae22..5dded8c32dd 100644 --- a/lib/private/Files/Cache/Cache.php +++ b/lib/private/Files/Cache/Cache.php @@ -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()); |