Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
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 <[email protected]>
  • Loading branch information
ChristophWurst authored and MorrisJobke committed Oct 12, 2020
commit 02fa3253fe82673e14b03e78b4e30a61d8982c19
2 changes: 1 addition & 1 deletion apps/files_versions/lib/Storage.php
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@ public static function expire($filename, $uid) {
// 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);
Expand Down