Bug #67731 [Com]: finfo::file() returns invalid mime type for binary files
| From: | florian at margaine dot com | Date: | Fri, 29 Aug 2014 23:15:38 +0000 |
| Subject: | Bug #67731 [Com]: finfo::file() returns invalid mime type for binary files | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-187344@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=67731&edit=1
ID: 67731
Comment by: florian at margaine dot com
Reported by: norbert at linuxnetworks dot de
Summary: finfo::file() returns invalid mime type for binary
files
Status: Open
Type: Bug
Package: Filesystem function related
Operating System: travis-ci
PHP Version: 5.6.0RC2
Block user comment: N
Private report: N
New Comment:
Do you have a file example? I get application/x-executable on a simple compiled (so, binary) file.
Test case here if needed: https://github.com/Ralt/php-src/commit/5ddce3b13751a6a4e80f73b9df108137c6e40f9d
Previous Comments:
------------------------------------------------------------------------
[2014-07-31 21:10:38] norbert at linuxnetworks dot de
Description:
------------
Compared to PHP 5.3 to 5.5, version 5.6RC2 returns a different mime type for binary files:
"binary" instead of "application/octet-stream"
Test script:
---------------
$filename = '<name of binary file>';
$finfo = new finfo( FILEINFO_MIME_TYPE );
$mimetype = $finfo->file( $filename );
echo $mimetype . PHP_EOL;
Expected result:
----------------
PHP 5.3, 5.4, 5.5: application/octet-stream
Actual result:
--------------
PHP 5.6RC2: binary (invalid as all mimetypes are "type/subtype")
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=67731&edit=1