diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-10-08 19:52:29 +0200 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2020-10-13 15:46:31 +0000 |
commit | 92ac576e1c61cb75d45a34a7bc1836877a6c3a89 (patch) | |
tree | a6cae60ccb7b3ae1d8780f8024e090ec05edd3dd /apps/files_versions | |
parent | ac465f2c872fb9b8681b1c938fba4cc3a49cfeae (diff) | |
download | nextcloud-server-92ac576e1c61cb75d45a34a7bc1836877a6c3a89.tar.gz nextcloud-server-92ac576e1c61cb75d45a34a7bc1836877a6c3a89.zip |
Fix undefined index and consequential damages in versions code
If the user has no space and there are no versions, there won't be an
`all` index in the versions entry. Hence this triggers a warning and
becomes `null`, afterwards `count`, `foreach` and friends will happily
throw even more warnings and errors because they don't want to play with
`null`. Thus adding a fallback to an empty array.
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/files_versions')
-rw-r--r-- | apps/files_versions/lib/Storage.php | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/apps/files_versions/lib/Storage.php b/apps/files_versions/lib/Storage.php index a83ec348827..04bfa1c7c3f 100644 --- a/apps/files_versions/lib/Storage.php +++ b/apps/files_versions/lib/Storage.php @@ -776,7 +776,7 @@ class Storage { // if still not enough free space we rearrange the versions from all files if ($availableSpace <= 0) { $result = Storage::getAllVersions($uid); - $allVersions = $result['all']; + $allVersions = $result['all'] ?? []; foreach ($result['by_file'] as $versions) { list($toDeleteNew, $size) = self::getExpireList($time, $versions, $availableSpace <= 0); |