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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
50 + 29 = ?
Subscribe to this entry?

 
 [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 26 03:01:32 2024 UTC