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:24:01 +0300 |
commit | 3fbd7a660285d44928210483948dd8aa7fe222fa (patch) | |
tree | db131d8574eb58b9b44d7361d156c5f9e9131503 | |
parent | 1f5dbfae4585a577aea4afab9b9c7e116a786239 (diff) |
Check whether entry is of type ICacheEntry in Cache->remove()backport/33050/stable22
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 5420fb73d7f..34388d87cc0 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()); |