From 5634ba6d97e80735a1bd3426cdeec877cf605b05 Mon Sep 17 00:00:00 2001 From: Shish Date: Mon, 5 Nov 2018 20:02:40 +0000 Subject: [PATCH] fix a thing which doesn't seem like a syntax error but phpstorm flags it as a syntax error --- core/util.inc.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/util.inc.php b/core/util.inc.php index 3280d6c4..650b472c 100644 --- a/core/util.inc.php +++ b/core/util.inc.php @@ -683,7 +683,7 @@ function is_https_enabled(): bool { return (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off'); } -define("MIME_TYPE_MAP", [ +const MIME_TYPE_MAP = [ 'jpg' => 'image/jpeg', 'gif' => 'image/gif', 'png' => 'image/png', 'tif' => 'image/tiff', 'tiff' => 'image/tiff', 'ico' => 'image/x-icon', 'swf' => 'application/x-shockwave-flash', 'video/x-flv' => 'flv', @@ -698,7 +698,7 @@ define("MIME_TYPE_MAP", [ 'avi' => 'video/x-msvideo', 'mpg' => 'video/mpeg', 'mpeg' => 'video/mpeg', 'mov' => 'video/quicktime', 'flv' => 'video/x-flv', 'php' => 'text/x-php', 'mp4' => 'video/mp4', 'ogv' => 'video/ogg', 'webm' => 'video/webm' -]); +]; /** * Get MIME type for file @@ -715,7 +715,7 @@ function getMimeType(string $file, string $ext=""): string { // Static extension lookup $ext = strtolower($ext); - if (isset(MIME_TYPE_MAP[$ext])) { return MIME_TYPE_MAP[$ext]; } + if (array_key_exists($ext, MIME_TYPE_MAP)) { return MIME_TYPE_MAP[$ext]; } $type = false; // Fileinfo documentation says fileinfo_open() will use the