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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 21:01:30 2024 UTC