From a7bf60772abe2968c11e830b95a20685f76d1ad7 Mon Sep 17 00:00:00 2001 From: Daniel Kesselberg Date: Mon, 13 Jun 2022 11:58:16 +0200 Subject: [PATCH] Fix Uninitialized string offset 0 at GenerateMimetypeFileBuilder.php#39 Signed-off-by: Daniel Kesselberg --- .../Mimetype/GenerateMimetypeFileBuilder.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/core/Command/Maintenance/Mimetype/GenerateMimetypeFileBuilder.php b/core/Command/Maintenance/Mimetype/GenerateMimetypeFileBuilder.php index 97432473722..873744e6f94 100644 --- a/core/Command/Maintenance/Mimetype/GenerateMimetypeFileBuilder.php +++ b/core/Command/Maintenance/Mimetype/GenerateMimetypeFileBuilder.php @@ -30,17 +30,15 @@ namespace OC\Core\Command\Maintenance\Mimetype; class GenerateMimetypeFileBuilder { /** * Generate mime type list file - * @param $aliases + * + * @param array $aliases * @return string */ public function generateFile(array $aliases): string { // Remove comments - $keys = array_filter(array_keys($aliases), function ($k) { - return $k[0] === '_'; - }); - foreach ($keys as $key) { - unset($aliases[$key]); - } + $aliases = array_filter($aliases, static function ($key) { + return !($key === '' || $key[0] === '_'); + }, ARRAY_FILTER_USE_KEY); // Fetch all files $dir = new \DirectoryIterator(\OC::$SERVERROOT.'/core/img/filetypes'); -- 2.39.5