Edit report at http://bugs.php.net/bug.php?id=53035&edit=1
ID: 53035
Updated by: felipe@php.net
Reported by: stuart at horuskol dot net
Summary: finfo_file() returns incorrect mimetype
Status: Open
Type: Bug
Package: Filesystem function related
Operating System: Linux/Ubuntu 10.04
PHP Version: Irrelevant
Block user comment: N
New Comment:
Strange... It's caused by the comment in the begin of the CSS file.
Previous Comments:
------------------------------------------------------------------------
[2010-10-10 13:37:04] stuart at horuskol dot net
Description:
------------
This is tested on:
PHP 5.3.2-1ubuntu4.5 with Suhosin-Patch (cli) (built: Sep 17 2010
13:49:46)
file_info() is reporting a CSS file has having the mimetype 'text/x-c'
instead of 'text/css'
however, the command line tool 'mimetype' correctly identifies the file
using the same library at '/usr/share/misc/magic'
the file being tested is available at http://horuskol.net/reset.css
Test script:
---------------
PHP:
$finfo = new finfo(FILEINFO_MIME);
var_dump($finfo->file('/path/to/file/reset.css'));
$finfo = new finfo(FILEINFO_MIME, '/usr/share/misc/magic');
var_dump($finfo->file('/path/to/file/reset.css'));
$finfo = finfo_open(FILEINFO_MIME, '/usr/share/misc/magic');
var_dump(finfo_file($finfo, '/path/to/file/reset.css'));
Command Line:
mimetype -DM --database /usr/share/misc/magic /path/to/file/reset.css
Expected result:
----------------
string(26) "text/css; charset=us-ascii"
Actual result:
--------------
string(26) "text/x-c; charset=us-ascii"
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=53035&edit=1