php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67731 finfo::file() returns invalid mime type for binary files
Submitted: 2014-07-31 21:10 UTC Modified: -
From: norbert at linuxnetworks dot de Assigned:
Status: Closed Package: Filesystem function related
PHP Version: 5.6.0RC2 OS: travis-ci
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: norbert at linuxnetworks dot de
New email:
PHP Version: OS:

 

 [2014-07-31 21:10 UTC] 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")

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-08-29 23:15 UTC] florian at margaine dot com
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
 [2014-08-30 02:07 UTC] ab@php.net
Automatic comment on behalf of ab
Revision: http://git.php.net/?p=php-src.git;a=commit;h=c301467f9ba07384386fa0f61c0c63cb4da037d0
Log: Fixed bug #67731 finfo::file() returns invalid mime type for binary files
 [2014-08-30 02:07 UTC] ab@php.net
-Status: Open +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 19:01:29 2024 UTC