Bug #69107 [Com]: finfo no longer detects PHP files
Edit report at https://bugs.php.net/bug.php?id=69107&edit=1
ID: 69107
Comment by: arjen at react dot com
Reported by: arjen at react dot com
Summary: finfo no longer detects PHP files
Status: Open
Type: Bug
Package: Filesystem function related
Operating System: Linux
PHP Version: master-Git-2015-02-23 (Git)
Block user comment: N
Private report: N
New Comment:
This is fixed now, see http://3v4l.org/2ZP6h
Please close issue or add as testcase.
Previous Comments:
------------------------------------------------------------------------
[2015-02-23 09:19:07] arjen at react dot com
Description:
------------
Some PHP files are marked as 'text/plain', previously 'text/x-php'.
See http://3v4l.org/2ZP6h
Test script:
---------------
<?php
$finfo = new finfo(FILEINFO_MIME_TYPE);
var_dump($finfo->buffer("<?php\nclass A{}"));
var_dump($finfo->buffer("<?php class A{}"));
var_dump($finfo->buffer("<?php\tclass A{}"));
var_dump($finfo->buffer("<?php\n\rclass A{}"));
Expected result:
----------------
string(10) "text/x-php"
string(10) "text/x-php"
string(10) "text/x-php"
string(10) "text/x-php"
Actual result:
--------------
string(10) "text/plain"
string(10) "text/x-php"
string(10) "text/x-php"
string(10) "text/x-php"
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=69107&edit=1
Thread (4 messages)