diff options
author | Louis <6653109+artonge@users.noreply.github.com> | 2022-10-11 11:15:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-11 11:15:05 +0200 |
commit | e4d3344076957f40b3cdbab779c3d54fd4c17377 (patch) | |
tree | 25528ee944ad4f325eda5484db1520fb71ed390d /core | |
parent | 5fd3971f35bfd2a7b9e8cf8fd69050035da5e974 (diff) | |
parent | 6f3ab2fc9b327903f0c6cde26100d3ebfb13f548 (diff) | |
download | nextcloud-server-e4d3344076957f40b3cdbab779c3d54fd4c17377.tar.gz nextcloud-server-e4d3344076957f40b3cdbab779c3d54fd4c17377.zip |
Merge pull request #32859 from nextcloud/bug/31973/array-key-might-be-empty
Fix Uninitialized string offset 0 at GenerateMimetypeFileBuilder.php#39
Diffstat (limited to 'core')
-rw-r--r-- | core/Command/Maintenance/Mimetype/GenerateMimetypeFileBuilder.php | 12 |
1 files 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'); |