|  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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
46 - 44 = ?
Subscribe to this entry?

 [2014-07-31 21:10 UTC] norbert at linuxnetworks dot de
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")


Add a Patch

Pull Requests

Add a Pull Request


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:
 [2014-08-30 02:07 UTC]
Automatic comment on behalf of ab
Log: Fixed bug #67731 finfo::file() returns invalid mime type for binary files
 [2014-08-30 02:07 UTC]
-Status: Open +Status: Closed
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Jul 12 18:01:29 2024 UTC