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>
This commit is contained in:
parent
4af8bf2468
commit
8a25ded758
|
@ -776,7 +776,7 @@ class Storage {
|
||||||
// if still not enough free space we rearrange the versions from all files
|
// if still not enough free space we rearrange the versions from all files
|
||||||
if ($availableSpace <= 0) {
|
if ($availableSpace <= 0) {
|
||||||
$result = Storage::getAllVersions($uid);
|
$result = Storage::getAllVersions($uid);
|
||||||
$allVersions = $result['all'];
|
$allVersions = $result['all'] ?? [];
|
||||||
|
|
||||||
foreach ($result['by_file'] as $versions) {
|
foreach ($result['by_file'] as $versions) {
|
||||||
list($toDeleteNew, $size) = self::getExpireList($time, $versions, $availableSpace <= 0);
|
list($toDeleteNew, $size) = self::getExpireList($time, $versions, $availableSpace <= 0);
|
||||||
|
|
Loading…
Reference in New Issue