From 15963b7165b0acdd994767735152284289e1768d Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Wed, 20 Mar 2013 05:42:51 -0400
Subject: [PATCH] Workaround for some versions/systems where finfo_open() with second argument doesn't do the same as with no 2nd argument as it should
---
program/lib/Roundcube/rcube_mime.php | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/program/lib/Roundcube/rcube_mime.php b/program/lib/Roundcube/rcube_mime.php
index ac4be95..b70d681 100644
--- a/program/lib/Roundcube/rcube_mime.php
+++ b/program/lib/Roundcube/rcube_mime.php
@@ -672,7 +672,16 @@
// 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
--
Gitblit v1.9.1