diff --git a/MD_STD.php b/MD_STD.php index 73ef091..2438ed8 100644 --- a/MD_STD.php +++ b/MD_STD.php @@ -397,13 +397,15 @@ final class MD_STD { return; } - $finfo = \finfo_open(FILEINFO_MIME_TYPE); + if (!($finfo = \finfo_open(FILEINFO_MIME_TYPE))) { + throw new Exception("Cannot open finfo context"); + } if (!($mime_type = finfo_file($finfo, $filepath))) { throw new MDWrongFileType("Cannot get mime type of file: " . basename($filepath)); } \finfo_close($finfo); - if (!\in_array($mime_type, $accepted_mimetype)) { + if (!\in_array($mime_type, $accepted_mimetype, true)) { throw new MDWrongFileType("Incorrect mime type of file " . \basename($filepath) . ". Mime type is " . \mime_content_type($filepath) . ", accepted any of ['" . \implode("', '", $accepted_mimetype) . "']"); }