Bug #55182 [Fbk->NoF]: finfo_file() doesn't detect right mime-type
| From: | php-bugs at lists dot php dot net | Date: | Sun, 04 Dec 2016 04:22:18 +0000 |
| Subject: | Bug #55182 [Fbk->NoF]: finfo_file() doesn't detect right mime-type | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-205756@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: php-bugs@lists.php.net
Reported by: dominique at ramaekers-stassart dot be
Summary: finfo_file() doesn't detect right mime-type
-Status: Feedback
+Status: No Feedback
Type: Bug
Package: Unknown/Other Function
Operating System: Ubuntu 10.04
PHP Version: 5.3SVN-2011-07-11 (SVN)
Private report: N
New Comment:
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
Previous Comments:
------------------------------------------------------------------------
[2016-11-24 16:02:18] ab@php.net
Thanks for the report. The concrete file is needed in this case.
Thanks.
------------------------------------------------------------------------
[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