Check whether entry is of type ICacheEntry in Cache->remove()

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>
This commit is contained in:
Jonas 2022-06-28 15:27:09 +01:00 committed by Jonas (Rebase PR Action)
parent 47934494f6
commit aec0899efd

View 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());