php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73006 String is recognized as zlib
Submitted: 2016-09-02 19:08 UTC Modified: 2016-09-02 20:28 UTC
From: rasi at xssn dot at Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 7.0.10 OS: Arch Linux 64bit
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: rasi at xssn dot at
New email:
PHP Version: OS:

 

 [2016-09-02 19:08 UTC] rasi at xssn dot at
Description:
------------
The string "(Singer/Songwriter) Andrea Schroeder                   Void" is reported as zlib mimetype by php.

Test script:
---------------
save above string in a file and use the following script to identify mimetype with php:

<?php

function mimetype($file) {
	$fileinfo = new finfo(FILEINFO_MIME_TYPE);
	$mimetype = $fileinfo->file($file);
	return $mimetype;
}

echo mimetype($argv[1]);


Expected result:
----------------
I expect mimetype text/plain

Actual result:
--------------
Actual result is application/zlib

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-09-02 19:19 UTC] rasi at xssn dot at
It's actually the "(S" at the start of the string that triggers this
 [2016-09-02 20:28 UTC] requinix@php.net
-Status: Open +Status: Not a bug -Package: *General Issues +Package: Filesystem function related
 [2016-09-02 20:28 UTC] requinix@php.net
"(S" 0x2853 are magic bytes for application/zlib data. We can't change that.

MIME typing is great and all but generally works best with binary files. Sometimes you should rely on file extensions instead.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 01 17:01:34 2025 UTC