fix PHP 8 error: key() Argument #1 must be of type array, null given

This commit is contained in:
Ralf Becker 2021-04-07 13:12:19 +02:00
parent 3bc0b55d54
commit e03b1aeb16

View File

@ -409,7 +409,7 @@ class Vfs extends File
$response = Json\Response::get(); $response = Json\Response::get();
$readonlys = $sel_options = array(); $readonlys = $sel_options = array();
if (isset($params['mime'])) if (!empty($params['mime']))
{ {
foreach((array)$params['mime'] as $key => $value) foreach((array)$params['mime'] as $key => $value)
{ {
@ -441,7 +441,7 @@ class Vfs extends File
{ {
throw new Api\Exception\WrongParameter("Wrong or unset required mode parameter!"); throw new Api\Exception\WrongParameter("Wrong or unset required mode parameter!");
} }
if (isset($params['mime'])) if (!empty($params['mime']))
{ {
$content['showmime'] = true; $content['showmime'] = true;
$content['mime'] = key($sel_options['mime']); $content['mime'] = key($sel_options['mime']);