Bug #73006 [Opn->Nab]: String is recognized as zlib
Edit report at https://bugs.php.net/bug.php?id=73006&edit=1
ID: 73006
Updated by: requinix@php.net
Reported by: rasi at xssn dot at
Summary: String is recognized as zlib
-Status: Open
+Status: Not a bug
Type: Bug
-Package: *General Issues
+Package: Filesystem function related
Operating System: Arch Linux 64bit
PHP Version: 7.0.10
Block user comment: N
Private report: N
New Comment:
"(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.
Previous Comments:
------------------------------------------------------------------------
[2016-09-02 19:19:28] rasi at xssn dot at
It's actually the "(S" at the start of the string that triggers this
------------------------------------------------------------------------
[2016-09-02 19:08:18] 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
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=73006&edit=1
Thread (3 messages)