Bug #53035 [NEW]: finfo_file() returns incorrect mimetype

From: Date: Sun, 10 Oct 2010 11:37:05 +0000
Subject: Bug #53035 [NEW]: finfo_file() returns incorrect mimetype
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-155055@lists.php.net to get a copy of this message
From:             
Operating system: Linux/Ubuntu 10.04
PHP version:      Irrelevant
Package:          Filesystem function related
Bug Type:         Bug
Bug description:finfo_file() returns incorrect mimetype

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 bug report at http://bugs.php.net/bug.php?id=53035&edit=1
-- 
Try a snapshot (PHP 5.2):            http://bugs.php.net/fix.php?id=53035&r=trysnapshot52
Try a snapshot (PHP 5.3):            http://bugs.php.net/fix.php?id=53035&r=trysnapshot53
Try a snapshot (trunk):              http://bugs.php.net/fix.php?id=53035&r=trysnapshottrunk
Fixed in SVN:                        http://bugs.php.net/fix.php?id=53035&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=53035&r=needdocs
Fixed in release:                    http://bugs.php.net/fix.php?id=53035&r=alreadyfixed
Need backtrace:                      http://bugs.php.net/fix.php?id=53035&r=needtrace
Need Reproduce Script:               http://bugs.php.net/fix.php?id=53035&r=needscript
Try newer version:                   http://bugs.php.net/fix.php?id=53035&r=oldversion
Not developer issue:                 http://bugs.php.net/fix.php?id=53035&r=support
Expected behavior:                   http://bugs.php.net/fix.php?id=53035&r=notwrong
Not enough info:                     http://bugs.php.net/fix.php?id=53035&r=notenoughinfo
Submitted twice:                     http://bugs.php.net/fix.php?id=53035&r=submittedtwice
register_globals:                    http://bugs.php.net/fix.php?id=53035&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=53035&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=53035&r=dst
IIS Stability:                       http://bugs.php.net/fix.php?id=53035&r=isapi
Install GNU Sed:                     http://bugs.php.net/fix.php?id=53035&r=gnused
Floating point limitations:          http://bugs.php.net/fix.php?id=53035&r=float
No Zend Extensions:                  http://bugs.php.net/fix.php?id=53035&r=nozend
MySQL Configuration Error:           http://bugs.php.net/fix.php?id=53035&r=mysqlcfg



Thread (23 messages)

« previous php.bugs (#155055) next »