php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69107 finfo no longer detects PHP files
Submitted: 2015-02-23 09:19 UTC Modified: 2016-08-08 17:03 UTC
From: arjen at react dot com Assigned: cmb (profile)
Status: Closed Package: Filesystem function related
PHP Version: master-Git-2015-02-23 (Git) OS: Linux
Private report: No CVE-ID: None
 [2015-02-23 09:19 UTC] 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"

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-04-24 07:57 UTC] arjen at react dot com
This is fixed now, see http://3v4l.org/2ZP6h

Please close issue or add as testcase.
 [2016-08-08 16:32 UTC] cmb@php.net
-Assigned To: +Assigned To: cmb
 [2016-08-08 16:32 UTC] cmb@php.net
For the record: this issue has most likely been fixed with
<https://github.com/php/php-src/commit/10367fa7>.

I'm going to add the regression test.
 [2016-08-08 17:03 UTC] cmb@php.net
-Status: Assigned +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 06:01:30 2024 UTC