Merge pull request #20449 from liamjack/fix/19066/empty_file_versions

Array offset error due to empty file versions array
This commit is contained in:
Roeland Jago Douma 2020-04-18 10:54:19 +02:00 committed by GitHub
commit 64196ddd19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -641,6 +641,11 @@ class Storage {
} }
$firstVersion = reset($versions); $firstVersion = reset($versions);
if ($firstVersion === false) {
return [$toDelete, $size];
}
$firstKey = key($versions); $firstKey = key($versions);
$prevTimestamp = $firstVersion['version']; $prevTimestamp = $firstVersion['version'];
$nextVersion = $firstVersion['version'] - $step; $nextVersion = $firstVersion['version'] - $step;

View File

@ -274,6 +274,11 @@ class VersioningTest extends \Test\TestCase {
], ],
9 // size of all deleted files (every file has the size 1) 9 // size of all deleted files (every file has the size 1)
], ],
// fourth set of versions: empty (see issue #19066)
[
[],
0
]
]; ];
} }