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- committed Jun 30, 2022
1 parent 4793449 commit aec0899
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 @@ -540,7 +540,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 aec0899

Please sign in to comment.