Bug #55182 [Com]: finfo_file() doesn't detect right mime-type
| From: | tom at tombartling dot com | Date: | Tue, 14 Aug 2012 19:58:38 +0000 |
| Subject: | Bug #55182 [Com]: finfo_file() doesn't detect right mime-type | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-172612@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=55182&edit=1
ID: 55182
Comment by: tom at tombartling dot com
Reported by: dominique at ramaekers-stassart dot be
Summary: finfo_file() doesn't detect right mime-type
Status: Open
Type: Bug
Package: Unknown/Other Function
Operating System: Ubuntu 10.04
PHP Version: 5.3SVN-2011-07-11 (SVN)
Block user comment: N
Private report: N
New Comment:
This also fails to detect the correct mime-type for PHP files. If the file starts with <?php, it
returns text/x-php as the mime-type. If the file starts with <!DOCTYPE html><html>...
and the PHP code is anywhere else in the file, it returns text/html as the mime-type.
It fails to detect a CSV file correctly.
This is a problem for the CodeIgniter framework, since it's file upload class uses this
function.
I'm on Red Hat Enterprise Linux Server release 5.8 (Tikanga).
Previous Comments:
------------------------------------------------------------------------
[2011-07-11 16:33:30] dominique at ramaekers-stassart dot be
Description:
------------
The finfo_file command detects openxml documents (xlsb, xlsx,...) as application/zip files.
Can this be fixed?
There are a lot of people who have to hack the mediawiki code to allow these files for upload. With
these hacks they lose a part of there security: the checking of the finfo_file-mime-type against the
file extension itself...
Test script:
---------------
php > $finfo = finfo_open(FILEINFO_MIME_TYPE);
php > echo finfo_file($finfo, '/mnt/Transfert/test.xlsb');
application/zip
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=55182&edit=1