Workaround for some versions/systems where finfo_open() with second

argument doesn't do the same as with no 2nd argument as it should
pull/62/head
Aleksander Machniak 12 years ago
parent 02c9c931fe
commit 4f693e9daa

@ -672,7 +672,16 @@ class rcube_mime
// try fileinfo extension if available // try fileinfo extension if available
if (!$mime_type && function_exists('finfo_open')) { if (!$mime_type && function_exists('finfo_open')) {
if ($finfo = finfo_open(FILEINFO_MIME, $mime_magic)) { // null as a 2nd argument should be the same as no argument
// this however is not true on all systems/versions
if ($mime_magic) {
$finfo = finfo_open(FILEINFO_MIME, $mime_magic);
}
else {
$finfo = finfo_open(FILEINFO_MIME);
}
if ($finfo) {
if ($is_stream) if ($is_stream)
$mime_type = finfo_buffer($finfo, $path); $mime_type = finfo_buffer($finfo, $path);
else else

Loading…
Cancel
Save