Bug #53035 [NEW]: finfo_file() returns incorrect mimetype
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)
- stuart at horuskol dot net
- felipe@php.netBug #53035 [Opn]: finfo_file() returns incorrect mimetype
- aharvey@php.netBug #53035 [Opn->Bgs]: finfo_file() returns incorrect mimetype
- stuart at horuskol dot netBug #53035 [Com]: finfo_file() returns incorrect mimetype
- stephane at emark dot nlBug #53035 [Com]: finfo_file() returns incorrect mimetype
- shawn at thesignchef dot comBug #53035 [Com]: finfo_file() returns incorrect mimetype
- n dot delargy at ctidigital dot comBug #53035 [Com]: finfo_file() returns incorrect mimetype
- n dot delargy at ctidigital dot comBug #53035 [Com]: finfo_file() returns incorrect mimetype
- DonJaime at donjaime dot deBug #53035 [Com]: finfo_file() returns incorrect mimetype
- pajoye@php.netBug #53035 [Nab->Fbk]: finfo_file() returns incorrect mimetype
- stepan dot stepanov at gmail dot comBug #53035 [Com]: finfo_file() returns incorrect mimetype
- a dot lecca at gmail dot comBug #53035 [Com]: finfo_file() returns incorrect mimetype
- php-bugs at lists dot php dot netBug #53035 [Fbk->NoF]: finfo_file() returns incorrect mimetype
- stepan dot stepanov at gmail dot comBug #53035 [Com]: finfo_file() returns incorrect mimetype
- pajoye@php.netBug #53035 [NoF->Fbk]: finfo_file() returns incorrect mimetype
- stepan dot stepanov at gmail dot comBug #53035 [Com]: finfo_file() returns incorrect mimetype
- pajoye@php.netBug #53035 [Fbk]: finfo_file() returns incorrect mimetype
- stepan dot stepanov at gmail dot comBug #53035 [Com]: finfo_file() returns incorrect mimetype
- stepan dot stepanov at gmail dot comBug #53035 [Com]: finfo_file() returns incorrect mimetype
- chuck at manchuck dot comBug #53035 [Com]: finfo_file() returns incorrect mimetype
- php-bugs at lists dot php dot netBug #53035 [Fbk->NoF]: finfo_file() returns incorrect mimetype
- max451f at gmail dot comBug #53035 [Com]: finfo_file() returns incorrect mimetype
- pajoye@php.netBug #53035 [NoF->Nab]: finfo_file() returns incorrect mimetype