Edit report at https://bugs.php.net/bug.php?id=53035&edit=1

 ID:                 53035
 Comment by:         stepan dot stepanov at gmail dot com
 Reported by:        stuart at horuskol dot net
 Summary:            finfo_file() returns incorrect mimetype
 Status:             Feedback
 Type:               Bug
 Package:            Filesystem function related
 Operating System:   Linux/Ubuntu 10.04
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

Is this bug stil alive ?
Does it have any change to be fixed ?

We really need it to filter uploaded files, obviously for security reasons.

Should we switch to "file" command of OS or make it sence to wait for a fix ?


Previous Comments:
------------------------------------------------------------------------
[2013-02-26 16:48:08] stepan dot stepanov at gmail dot com

PHP fileinfo library = 1.0.5-dev

------------------------------------------------------------------------
[2013-02-25 18:37:09] paj...@php.net

no, I meant the file/fileinfo library on your system. "file" and php does not 
share the same version.

------------------------------------------------------------------------
[2013-02-25 15:57:31] stepan dot stepanov at gmail dot com

Do you mean version of PHP ?

PHP 5.3.19 (cli)

------------------------------------------------------------------------
[2013-02-25 15:55:23] paj...@php.net

Which version do you use on this system?

We may need to update the bundled database or library.

------------------------------------------------------------------------
[2013-02-25 14:59:42] stepan dot stepanov at gmail dot com

Command line "file" programm shows the right result. Though php reports wrong 
one.
CentOS release 5.8

See details below:

$ file -i char2.csv
char2.csv: text/plain; charset=us-ascii
$ file -i char.csv
char.csv: text/plain; charset=us-ascii
$ php -f mimetest.php
char2.csv: text/plain
char.cvs: text/x-c
$ diff -u char2.csv char.csv
--- char2.csv   2012-10-10 15:07:05.000000000 +0200
+++ char.csv    2013-02-25 15:47:38.000000000 +0100
@@ -1,3 +1,4 @@
 stepan.stepa...@somewhere.com
 stepan.stepa...@somewhereelse.com
+charlo...@server.com
 herr.totalschei...@mime.typ

----------------------------------------------------------

$ php -v
PHP 5.3.19 (cli) (built: Nov 25 2012 13:17:45)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
    with Xdebug v2.1.3, Copyright (c) 2002-2012, by Derick Rethans
$ cat mimetest.php
<?
$finfo = new finfo(FILEINFO_MIME_TYPE);

echo "\nchar2.csv: ".$finfo->file('char2.csv');
echo "\nchar.cvs: ".$finfo->file('char.csv');
?>

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=53035


-- 
Edit this bug report at https://bugs.php.net/bug.php?id=53035&edit=1

Reply via email to