Skip to content

Commit

Permalink
Check whether entry is of type ICacheEntry in Cache->remove()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
mejo- authored and backportbot-nextcloud[bot] committed Jun 29, 2022
1 parent 02596df commit 379e265
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/private/Files/Cache/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ public function inCache($file) {
public function remove($file) {
$entry = $this->get($file);

if ($entry) {
if ($entry instanceof ICacheEntry) {
$query = $this->getQueryBuilder();
$query->delete('filecache')
->whereFileId($entry->getId());
Expand Down

0 comments on commit 379e265

Please sign in to comment.