summaryrefslogtreecommitdiff
path: root/program/lib
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-03-20 10:31:37 +0100
committerAleksander Machniak <alec@alec.pl>2013-03-20 10:31:37 +0100
commit4f693e9daa21185761d38dca9a0ba626be8c05cb (patch)
treebe9bb67aa5af25f2488f452238c020dfedb57604 /program/lib
parent02c9c931fe34c699ded288b449c6d2d457a41a76 (diff)
Workaround for some versions/systems where finfo_open() with second
argument doesn't do the same as with no 2nd argument as it should
Diffstat (limited to 'program/lib')
-rw-r--r--program/lib/Roundcube/rcube_mime.php11
1 files changed, 10 insertions, 1 deletions
diff --git a/program/lib/Roundcube/rcube_mime.php b/program/lib/Roundcube/rcube_mime.php
index ac4be95c0..b70d681c9 100644
--- a/program/lib/Roundcube/rcube_mime.php
+++ b/program/lib/Roundcube/rcube_mime.php
@@ -672,7 +672,16 @@ class rcube_mime
// try fileinfo extension if available
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)
$mime_type = finfo_buffer($finfo, $path);
else