Bug #75887 [Com]: mime type detection problem
| From: | tunderzone at gmail dot com | Date: | Tue, 30 Jan 2018 11:37:21 +0000 |
| Subject: | Bug #75887 [Com]: mime type detection problem | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-213752@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=75887&edit=1
ID: 75887
Comment by: tunderzone at gmail dot com
Reported by: tunderzone at gmail dot com
Summary: mime type detection problem
Status: Not a bug
Type: Bug
Package: Filesystem function related
PHP Version: 7.1.13
Block user comment: N
Private report: N
New Comment:
the text that cause this is not on first line nor last. it is somewhere in the middle of the file.
the file size is 14K.
running finfo_open and finfo_file on that file in php 5.5.38 yields text/plain but in php7.1.13
yields text/x-asm
something has changed from php 5 to php 7. this is why i posted this bug.
Previous Comments:
------------------------------------------------------------------------
[2018-01-29 23:29:15] requinix@php.net
MIME detection works by examining the first few bytes of a file (or input stream). It is not
perfect.
------------------------------------------------------------------------
[2018-01-29 21:21:43] tunderzone at gmail dot com
Description:
------------
having ".text" as first characters on any line of a css file will result in mime being
resolved as text/x-asm.
Test script:
---------------
<?php
$info = finfo_open(FILEINFO_MIME_TYPE);
$tipe = finfo_buffer($info, '.text {color: #CCCCCC;}');
var_dump($tipe);
finfo_close($info);
Expected result:
----------------
text/css
or
text/plain
Actual result:
--------------
text/x-asm
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=75887&edit=1