close statement in MimeType detection is executed [#7069]

close statement was never executed due to it being after a return
statement.
This commit is contained in:
Jens-Christian Fischer 2014-02-04 17:03:52 +01:00
parent 49f0f9f2f6
commit 11f46e121c
1 changed files with 2 additions and 1 deletions

View File

@ -72,11 +72,12 @@ class Detection {
and function_exists('finfo_file') and $finfo = finfo_open(FILEINFO_MIME) and function_exists('finfo_file') and $finfo = finfo_open(FILEINFO_MIME)
) { ) {
$info = @strtolower(finfo_file($finfo, $path)); $info = @strtolower(finfo_file($finfo, $path));
finfo_close($finfo);
if ($info) { if ($info) {
$mimeType = substr($info, 0, strpos($info, ';')); $mimeType = substr($info, 0, strpos($info, ';'));
return empty($mimeType) ? 'application/octet-stream' : $mimeType; return empty($mimeType) ? 'application/octet-stream' : $mimeType;
} }
finfo_close($finfo);
} }
$isWrapped = (strpos($path, '://') !== false) and (substr($path, 0, 7) === 'file://'); $isWrapped = (strpos($path, '://') !== false) and (substr($path, 0, 7) === 'file://');
if (!$isWrapped and $mimeType === 'application/octet-stream' && function_exists("mime_content_type")) { if (!$isWrapped and $mimeType === 'application/octet-stream' && function_exists("mime_content_type")) {