php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #79394 mime_content_type Reporting Incorrectly Returning application/zlib
Submitted: 2020-03-18 14:40 UTC Modified: 2020-03-18 14:50 UTC
From: scott dot newman at faa dot gov Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: Irrelevant OS: Red Hat 7.7
Private report: No CVE-ID: None
 [2020-03-18 14:40 UTC] scott dot newman at faa dot gov
Description:
------------
PHP Version is 7.1.23 but the drop down wouldn't let me select it. Version 7.1.23 is the version that's in the repository for RedHat 7 so I think it's still relevant.

To reproduce:
1) Create a text file that has content starting with "HK".
2) Use the PHP function "mime_content_type" to display the mime type.
3) The function incorrectly reports "application/zlib".

Test script:
---------------
<?php

var_dump(mime_content_type("file.txt"));

?>

Expected result:
----------------
application/zlib is reported instead of text/plain.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-03-18 14:50 UTC] requinix@php.net
-Status: Open +Status: Not a bug
 [2020-03-18 14:50 UTC] requinix@php.net
MIME type detection works by reading the first few bytes of a file and looking them up in a database. "HK" can indicate application/zlib files.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Fri Dec 04 02:01:23 2020 UTC