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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: scott dot newman at faa dot gov
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Fri Jul 04 17:01:35 2025 UTC