|  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: norbert at linuxnetworks dot de
New email:
PHP Version: OS:


 [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 19 09:01:28 2024 UTC