Bug #55182 [Opn->Fbk]: finfo_file() doesn't detect right mime-type
| From: | ab@php.net | Date: | Thu, 24 Nov 2016 16:02:20 +0000 |
| Subject: | Bug #55182 [Opn->Fbk]: finfo_file() doesn't detect right mime-type | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-205616@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
Updated by: ab@php.net
Reported by: dominique at ramaekers-stassart dot be
Summary: finfo_file() doesn't detect right mime-type
-Status: Open
+Status: Feedback
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:
Thanks for the report. The concrete file is needed in this case.
Thanks.
Previous Comments:
------------------------------------------------------------------------
[2012-08-15 15:04:28] narf at bofh dot bg
AFAIK, this is depends on the OS and external packages. MIME type detection isn't a problem
just for PHP and I doubt there's much that can be done about it.
------------------------------------------------------------------------
[2012-08-14 19:58:38] tom at tombartling dot com
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).
------------------------------------------------------------------------
[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