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

2013-05-01 Thread chuck at manchuck dot com
Edit report at https://bugs.php.net/bug.php?id=53035edit=1

 ID: 53035
 Comment by: chuck at manchuck 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:

We noticed that this bug is present in php 5.4.10 on windows.  We do not have 
the 
Suhosin-Patch installed:

PHP 5.4.10 (cli) (built: Dec 19 2012 20:33:35)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies
with Xdebug v2.2.1, Copyright (c) 2002-2012, by Derick Rethans

We also have the problem when a csv file is uploaded with Seven starting a line


Previous Comments:

[2013-03-25 17:56:54] stepan dot stepanov at gmail dot com

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 ?


[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.




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=53035edit=1


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

2013-03-25 Thread stepan dot stepanov at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=53035edit=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.0 +0200
+++ char.csv2013-02-25 15:47:38.0 +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=53035edit=1


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

2013-02-26 Thread stepan dot stepanov at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=53035edit=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:

PHP fileinfo library = 1.0.5-dev


Previous Comments:

[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.0 +0200
+++ char.csv2013-02-25 15:47:38.0 +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');
?


[2013-02-18 00:34:31] php-bugs at lists dot php dot net

No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to Open. Thank you.




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=53035edit=1


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

2013-02-25 Thread stepan dot stepanov at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=53035edit=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: No 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:

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.0 +0200
+++ char.csv2013-02-25 15:47:38.0 +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');
?


Previous Comments:

[2013-02-18 00:34:31] php-bugs at lists dot php dot net

No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to Open. Thank you.


[2013-01-17 23:03:53] a dot lecca at gmail dot com

On PHP 5.3.18
Keven will also trigger a text/x-asm mime type

Also, confirming the Charlotte issue


[2012-11-29 14:34:54] stepan dot stepanov at gmail dot com

The problem still exists (PHP 5.3.19)

If i have csv file with names (e.g.) it is recognised as text/plan (that is 
expected)

But when i have someone called 'charles' or 'charlotte' inside - my file is 
recognised as text/x-c (obviously dues to word 'char')


[2012-09-30 17:13:01] paj...@php.net

Please try using this snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/




[2012-09-29 11:00:33] DonJaime at donjaime dot de

This problem occurs with no comment at the start of the file, too.

Rather than giving up because other programs using the same magic database are 
resulting in the same file being detected as C source it might be worth 
putting in the extra few lines of code required to return the right mime type 
on the basis of the file extension, if it exists. Worldwide, this would save a 
lot of energy and frustration.




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=53035edit=1


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

2013-02-25 Thread stepan dot stepanov at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=53035edit=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:

Do you mean version of PHP ?

PHP 5.3.19 (cli)


Previous Comments:

[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.0 +0200
+++ char.csv2013-02-25 15:47:38.0 +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');
?


[2013-02-18 00:34:31] php-bugs at lists dot php dot net

No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to Open. Thank you.


[2013-01-17 23:03:53] a dot lecca at gmail dot com

On PHP 5.3.18
Keven will also trigger a text/x-asm mime type

Also, confirming the Charlotte issue


[2012-11-29 14:34:54] stepan dot stepanov at gmail dot com

The problem still exists (PHP 5.3.19)

If i have csv file with names (e.g.) it is recognised as text/plan (that is 
expected)

But when i have someone called 'charles' or 'charlotte' inside - my file is 
recognised as text/x-c (obviously dues to word 'char')




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=53035edit=1


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

2013-01-17 Thread a dot lecca at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=53035edit=1

 ID: 53035
 Comment by: a dot lecca 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:

On PHP 5.3.18
Keven will also trigger a text/x-asm mime type

Also, confirming the Charlotte issue


Previous Comments:

[2012-11-29 14:34:54] stepan dot stepanov at gmail dot com

The problem still exists (PHP 5.3.19)

If i have csv file with names (e.g.) it is recognised as text/plan (that is 
expected)

But when i have someone called 'charles' or 'charlotte' inside - my file is 
recognised as text/x-c (obviously dues to word 'char')


[2012-09-30 17:13:01] paj...@php.net

Please try using this snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/




[2012-09-29 11:00:33] DonJaime at donjaime dot de

This problem occurs with no comment at the start of the file, too.

Rather than giving up because other programs using the same magic database are 
resulting in the same file being detected as C source it might be worth 
putting in the extra few lines of code required to return the right mime type 
on the basis of the file extension, if it exists. Worldwide, this would save a 
lot of energy and frustration.


[2011-12-12 12:08:56] n dot delargy at ctidigital dot com

It may also be worth noting that the file was converted from an excel sheet to 
a text tab delimited and charset was us-ascii


[2011-12-12 12:06:42] n dot delargy at ctidigital dot com

I've also had this issue, using ZF Zend_Validate_File_MimeType a text/plain 
file (according to file -i /path/to/file.txt) is incorrectly identified as 
text/x-c in ubuntu 11.10




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=53035edit=1


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

2012-11-29 Thread stepan dot stepanov at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=53035edit=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:

The problem still exists (PHP 5.3.19)

If i have csv file with names (e.g.) it is recognised as text/plan (that is 
expected)

But when i have someone called 'charles' or 'charlotte' inside - my file is 
recognised as text/x-c (obviously dues to word 'char')


Previous Comments:

[2012-09-30 17:13:01] paj...@php.net

Please try using this snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/




[2012-09-29 11:00:33] DonJaime at donjaime dot de

This problem occurs with no comment at the start of the file, too.

Rather than giving up because other programs using the same magic database are 
resulting in the same file being detected as C source it might be worth 
putting in the extra few lines of code required to return the right mime type 
on the basis of the file extension, if it exists. Worldwide, this would save a 
lot of energy and frustration.


[2011-12-12 12:08:56] n dot delargy at ctidigital dot com

It may also be worth noting that the file was converted from an excel sheet to 
a text tab delimited and charset was us-ascii


[2011-12-12 12:06:42] n dot delargy at ctidigital dot com

I've also had this issue, using ZF Zend_Validate_File_MimeType a text/plain 
file (according to file -i /path/to/file.txt) is incorrectly identified as 
text/x-c in ubuntu 11.10


[2011-07-06 19:27:16] shawn at thesignchef dot com

I am having the same issue still. Has this been fixed or is there a workaround. 
Thanks so much.




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=53035edit=1


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

2012-09-29 Thread DonJaime at donjaime dot de
Edit report at https://bugs.php.net/bug.php?id=53035edit=1

 ID: 53035
 Comment by: DonJaime at donjaime dot de
 Reported by:stuart at horuskol dot net
 Summary:finfo_file() returns incorrect mimetype
 Status: Not a bug
 Type:   Bug
 Package:Filesystem function related
 Operating System:   Linux/Ubuntu 10.04
 PHP Version:Irrelevant
 Block user comment: N
 Private report: N

 New Comment:

This problem occurs with no comment at the start of the file, too.

Rather than giving up because other programs using the same magic database are 
resulting in the same file being detected as C source it might be worth 
putting in the extra few lines of code required to return the right mime type 
on the basis of the file extension, if it exists. Worldwide, this would save a 
lot of energy and frustration.


Previous Comments:

[2011-12-12 12:08:56] n dot delargy at ctidigital dot com

It may also be worth noting that the file was converted from an excel sheet to 
a text tab delimited and charset was us-ascii


[2011-12-12 12:06:42] n dot delargy at ctidigital dot com

I've also had this issue, using ZF Zend_Validate_File_MimeType a text/plain 
file (according to file -i /path/to/file.txt) is incorrectly identified as 
text/x-c in ubuntu 11.10


[2011-07-06 19:27:16] shawn at thesignchef dot com

I am having the same issue still. Has this been fixed or is there a workaround. 
Thanks so much.


[2010-11-09 16:57:47] stephane at emark dot nl

Hi, I just want to say that I experience the same problem.

As fel...@php.net mentionned, if you have any type of comments at the top of 
your 
file, the problem occurs. 
For example, if i try to get the mime type of a js file with comments at the 
top, 
it returns text/x-c, if i remove the comments, then it returns text/plain, 
which in and of itself is not correct as it should return 'text/javascript'.

Any idea how to circumvent this problem other than removing all my comments ?!?!


[2010-10-13 00:38:01] stuart at horuskol dot net

however, the command line tool 'mimetype' correctly identifies the file using 
the same library at '/usr/share/misc/magic'

I tested using the -M switch (as in my example/test script):

mimetype -DM --database /usr/share/misc/magic /path/to/file/reset.css

and this tells me the file is text/css on my platform - are you sure you're 
using the same magic database?




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=53035edit=1


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

2011-12-12 Thread n dot delargy at ctidigital dot com
Edit report at https://bugs.php.net/bug.php?id=53035edit=1

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

 New Comment:

I've also had this issue, using ZF Zend_Validate_File_MimeType a text/plain 
file (according to file -i /path/to/file.txt) is incorrectly identified as 
text/x-c in ubuntu 11.10


Previous Comments:

[2011-07-06 19:27:16] shawn at thesignchef dot com

I am having the same issue still. Has this been fixed or is there a workaround. 
Thanks so much.


[2010-11-09 16:57:47] stephane at emark dot nl

Hi, I just want to say that I experience the same problem.

As fel...@php.net mentionned, if you have any type of comments at the top of 
your 
file, the problem occurs. 
For example, if i try to get the mime type of a js file with comments at the 
top, 
it returns text/x-c, if i remove the comments, then it returns text/plain, 
which in and of itself is not correct as it should return 'text/javascript'.

Any idea how to circumvent this problem other than removing all my comments ?!?!


[2010-10-13 00:38:01] stuart at horuskol dot net

however, the command line tool 'mimetype' correctly identifies the file using 
the same library at '/usr/share/misc/magic'

I tested using the -M switch (as in my example/test script):

mimetype -DM --database /usr/share/misc/magic /path/to/file/reset.css

and this tells me the file is text/css on my platform - are you sure you're 
using the same magic database?


[2010-10-12 07:52:11] ahar...@php.net

I get the same result from the command line file program on Ubuntu 10.10:

$ curl -s http://horuskol.net/reset.css | file --mime-type -
/dev/stdin: text/x-c

mimetype also believes it's C source:

$ mimetype -DM reset.css 
 Data dirs are: /home/aharvey/.local/share, /usr/share/gnome, 
 /usr/local/share, /usr/share
 Checking all magic rules
 Value /* at offset 2 matches at /usr/share/mime/magic line 1136
reset.css: text/x-csrc

The only way I can get mimetype to return text/css is if it also looks at the 
extension (ie is called without -M).

I can't really see any way this is a PHP bug, given other programs using the 
same magic database are resulting in the same file being detected as C source. 
Closing.


[2010-10-11 15:39:35] fel...@php.net

Strange... It's caused by the comment in the begin of the CSS file.




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=53035edit=1


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

2011-12-12 Thread n dot delargy at ctidigital dot com
Edit report at https://bugs.php.net/bug.php?id=53035edit=1

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

 New Comment:

It may also be worth noting that the file was converted from an excel sheet to 
a text tab delimited and charset was us-ascii


Previous Comments:

[2011-12-12 12:06:42] n dot delargy at ctidigital dot com

I've also had this issue, using ZF Zend_Validate_File_MimeType a text/plain 
file (according to file -i /path/to/file.txt) is incorrectly identified as 
text/x-c in ubuntu 11.10


[2011-07-06 19:27:16] shawn at thesignchef dot com

I am having the same issue still. Has this been fixed or is there a workaround. 
Thanks so much.


[2010-11-09 16:57:47] stephane at emark dot nl

Hi, I just want to say that I experience the same problem.

As fel...@php.net mentionned, if you have any type of comments at the top of 
your 
file, the problem occurs. 
For example, if i try to get the mime type of a js file with comments at the 
top, 
it returns text/x-c, if i remove the comments, then it returns text/plain, 
which in and of itself is not correct as it should return 'text/javascript'.

Any idea how to circumvent this problem other than removing all my comments ?!?!


[2010-10-13 00:38:01] stuart at horuskol dot net

however, the command line tool 'mimetype' correctly identifies the file using 
the same library at '/usr/share/misc/magic'

I tested using the -M switch (as in my example/test script):

mimetype -DM --database /usr/share/misc/magic /path/to/file/reset.css

and this tells me the file is text/css on my platform - are you sure you're 
using the same magic database?


[2010-10-12 07:52:11] ahar...@php.net

I get the same result from the command line file program on Ubuntu 10.10:

$ curl -s http://horuskol.net/reset.css | file --mime-type -
/dev/stdin: text/x-c

mimetype also believes it's C source:

$ mimetype -DM reset.css 
 Data dirs are: /home/aharvey/.local/share, /usr/share/gnome, 
 /usr/local/share, /usr/share
 Checking all magic rules
 Value /* at offset 2 matches at /usr/share/mime/magic line 1136
reset.css: text/x-csrc

The only way I can get mimetype to return text/css is if it also looks at the 
extension (ie is called without -M).

I can't really see any way this is a PHP bug, given other programs using the 
same magic database are resulting in the same file being detected as C source. 
Closing.




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=53035edit=1


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

2011-07-06 Thread shawn at thesignchef dot com
Edit report at https://bugs.php.net/bug.php?id=53035edit=1

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

 New Comment:

I am having the same issue still. Has this been fixed or is there a workaround. 
Thanks so much.


Previous Comments:

[2010-11-09 16:57:47] stephane at emark dot nl

Hi, I just want to say that I experience the same problem.

As fel...@php.net mentionned, if you have any type of comments at the top of 
your 
file, the problem occurs. 
For example, if i try to get the mime type of a js file with comments at the 
top, 
it returns text/x-c, if i remove the comments, then it returns text/plain, 
which in and of itself is not correct as it should return 'text/javascript'.

Any idea how to circumvent this problem other than removing all my comments ?!?!


[2010-10-13 00:38:01] stuart at horuskol dot net

however, the command line tool 'mimetype' correctly identifies the file using 
the same library at '/usr/share/misc/magic'

I tested using the -M switch (as in my example/test script):

mimetype -DM --database /usr/share/misc/magic /path/to/file/reset.css

and this tells me the file is text/css on my platform - are you sure you're 
using the same magic database?


[2010-10-12 07:52:11] ahar...@php.net

I get the same result from the command line file program on Ubuntu 10.10:

$ curl -s http://horuskol.net/reset.css | file --mime-type -
/dev/stdin: text/x-c

mimetype also believes it's C source:

$ mimetype -DM reset.css 
 Data dirs are: /home/aharvey/.local/share, /usr/share/gnome, 
 /usr/local/share, /usr/share
 Checking all magic rules
 Value /* at offset 2 matches at /usr/share/mime/magic line 1136
reset.css: text/x-csrc

The only way I can get mimetype to return text/css is if it also looks at the 
extension (ie is called without -M).

I can't really see any way this is a PHP bug, given other programs using the 
same magic database are resulting in the same file being detected as C source. 
Closing.


[2010-10-11 15:39:35] fel...@php.net

Strange... It's caused by the comment in the begin of the CSS file.


[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 https://bugs.php.net/bug.php?id=53035edit=1


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

2010-11-09 Thread stephane at emark dot nl
Edit report at http://bugs.php.net/bug.php?id=53035edit=1

 ID: 53035
 Comment by: stephane at emark dot nl
 Reported by:stuart at horuskol dot net
 Summary:finfo_file() returns incorrect mimetype
 Status: Bogus
 Type:   Bug
 Package:Filesystem function related
 Operating System:   Linux/Ubuntu 10.04
 PHP Version:Irrelevant
 Block user comment: N

 New Comment:

Hi, I just want to say that I experience the same problem.



As fel...@php.net mentionned, if you have any type of comments at the
top of your 

file, the problem occurs. 

For example, if i try to get the mime type of a js file with comments at
the top, 

it returns text/x-c, if i remove the comments, then it returns
text/plain, 

which in and of itself is not correct as it should return
'text/javascript'.



Any idea how to circumvent this problem other than removing all my
comments ?!?!


Previous Comments:

[2010-10-13 00:38:01] stuart at horuskol dot net

however, the command line tool 'mimetype' correctly identifies the file
using the same library at '/usr/share/misc/magic'



I tested using the -M switch (as in my example/test script):



mimetype -DM --database /usr/share/misc/magic /path/to/file/reset.css



and this tells me the file is text/css on my platform - are you sure
you're using the same magic database?


[2010-10-12 07:52:11] ahar...@php.net

I get the same result from the command line file program on Ubuntu
10.10:



$ curl -s http://horuskol.net/reset.css | file --mime-type -

/dev/stdin: text/x-c



mimetype also believes it's C source:



$ mimetype -DM reset.css 

 Data dirs are: /home/aharvey/.local/share, /usr/share/gnome,
/usr/local/share, /usr/share

 Checking all magic rules

 Value /* at offset 2 matches at /usr/share/mime/magic line 1136

reset.css: text/x-csrc



The only way I can get mimetype to return text/css is if it also looks
at the extension (ie is called without -M).



I can't really see any way this is a PHP bug, given other programs using
the same magic database are resulting in the same file being detected as
C source. Closing.


[2010-10-11 15:39:35] fel...@php.net

Strange... It's caused by the comment in the begin of the CSS file.


[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=53035edit=1


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

2010-10-12 Thread stuart at horuskol dot net
Edit report at http://bugs.php.net/bug.php?id=53035edit=1

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

 New Comment:

however, the command line tool 'mimetype' correctly identifies the file
using the same library at '/usr/share/misc/magic'



I tested using the -M switch (as in my example/test script):



mimetype -DM --database /usr/share/misc/magic /path/to/file/reset.css



and this tells me the file is text/css on my platform - are you sure
you're using the same magic database?


Previous Comments:

[2010-10-12 07:52:11] ahar...@php.net

I get the same result from the command line file program on Ubuntu
10.10:



$ curl -s http://horuskol.net/reset.css | file --mime-type -

/dev/stdin: text/x-c



mimetype also believes it's C source:



$ mimetype -DM reset.css 

 Data dirs are: /home/aharvey/.local/share, /usr/share/gnome,
/usr/local/share, /usr/share

 Checking all magic rules

 Value /* at offset 2 matches at /usr/share/mime/magic line 1136

reset.css: text/x-csrc



The only way I can get mimetype to return text/css is if it also looks
at the extension (ie is called without -M).



I can't really see any way this is a PHP bug, given other programs using
the same magic database are resulting in the same file being detected as
C source. Closing.


[2010-10-11 15:39:35] fel...@php.net

Strange... It's caused by the comment in the begin of the CSS file.


[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=53035edit=1