Skip to content

Commit

Permalink
Merge pull request #32859 from nextcloud/bug/31973/array-key-might-be…
Browse files Browse the repository at this point in the history
…-empty

Fix Uninitialized string offset 0 at GenerateMimetypeFileBuilder.php#39
  • Loading branch information
artonge authored Oct 11, 2022
2 parents 5fd3971 + 6f3ab2f commit e4d3344
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,15 @@
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');
Expand Down

0 comments on commit e4d3344

Please sign in to comment.