php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33829 mime_content_type() returns text/plain for gzip and bzip files
Submitted: 2005-07-22 21:45 UTC Modified: 2005-12-24 13:33 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: mschering at intermesh dot nl Assigned: derick (profile)
Status: Closed Package: Filesystem function related
PHP Version: 4.3.11 OS: Linux (Debian)
Private report: No CVE-ID: None
 [2005-07-22 21:45 UTC] mschering at intermesh dot nl
Description:
------------
mime_content_type() returns text/plain for gzip and bzip files.

I guess this function looks the type up in /etc/mime.types.

The extensions are not in there and should bot be in there.The comments in the file say:

Note: Compression schemes like "gzip", "bzip", and "compress" are notactually "mime-types".  They are "encodings" and hence must _not_ have entries in this file to map their extensions.  The "mime-type" of an encoded file refers to the type of data that has been encoded, not the type of encoding.

My Mail application relies on this function for attaching files from the filesystem. With this kind of files it failes.

Please fix this.


Reproduce code:
---------------
run mime_content_type on a *.tar.gz file.

Expected result:
----------------
return application/gzip or something like that

Actual result:
--------------
returns text/plain

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-07-23 01:12 UTC] sniper@php.net
Please use the fileinfo extension from PECL instead.
(the mime_magic extension has been deprecated)


 [2005-08-01 13:20 UTC] derick@php.net
Actually, I have a fix for this. Just need to test it a bit more.
 [2005-12-24 02:26 UTC] sniper@php.net
Derick, isn't almost 5 months enough for testing? Just commit the patch..
 [2005-12-24 13:33 UTC] derick@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

I already fixed this, must have forgotten to close the bug:
http://cvs.php.net/viewcvs.cgi/php-src/ext/mime_magic/mime_magic.c?r1=1.42.2.2&r2=1.42.2.3
http://cvs.php.net/viewcvs.cgi/php-src/ext/mime_magic/mime_magic.c?r1=1.44&r2=1.45

Derick
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC