Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 65266 - file-4.10 and php mime_content_type()
Summary: file-4.10 and php mime_content_type()
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Unspecified (show other bugs)
Hardware: All Linux
: High major (vote)
Assignee: PHP Bugs
URL:
Whiteboard:
Keywords:
: 62357 62393 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-09-24 17:40 UTC by crucify
Modified: 2005-08-22 00:54 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description crucify 2004-09-24 17:40:02 UTC
file-4.10
mime_content_type() return 'text/plain' only

file-4.09
ok.

Reproducible: Always
Steps to Reproduce:
1.
2.
3.
Comment 1 Miroslav Šulc gentoo-dev 2004-10-09 05:00:40 UTC
I have the same problem with file-4.10-r1 and mod_php-5.0.2. file-4.09 works fine with mod_php. file-4.10-r1 alone works fine too. Maybe mod_php cannot parse the new file as mod_php says "invalid magic file, disabled" in output of phpinfo(). For case it can help here is the diff for magic.mime file:

$ diff /usr/share/misc/file/magic.mime magic.mime-4.10-r1
13a14,93
> # Real Audio (Magic .ra\0375)
> 0     belong          0x2e7261fd      audio/x-pn-realaudio
> 0     string          .RMF            application/vnd.rn-realmedia
>
> #video/x-pn-realvideo
> #video/vnd.rn-realvideo
> #application/vnd.rn-realmedia
> #     sigh, there are many mimes for that but the above are the most common.
>
> # Taken from magic, converted to magic.mime
> # mime types according to http://www.geocities.com/nevilo/mod.htm:
> #     audio/it        .it
> #     audio/x-zipped-it       .itz
> #     audio/xm        fasttracker modules
> #     audio/x-s3m     screamtracker modules
> #     audio/s3m       screamtracker modules
> #     audio/x-zipped-mod      mdz
> #     audio/mod       mod
> #     audio/x-mod     All modules (mod, s3m, 669, mtm, med, xm, it, mdz, stm, itz, xmz, s3z)
>
> # Taken from loader code from mikmod version 2.14
> # by Steve McIntyre (stevem@chiark.greenend.org.uk)
> # <doj@cubic.org> added title printing on 2003-06-24
> 0     string  MAS_UTrack_V00
> >14   string  >/0             audio/x-mod
> #audio/x-tracker-module
>
> #0    string  UN05            MikMod UNI format module sound data
>
> 0     string  Extended\ Module: audio/x-mod
> #audio/x-tracker-module
> ##>17 string  >\0             Title: "%s"
>
> 21    string/c        !SCREAM!        audio/x-mod
> #audio/x-screamtracker-module
> 21    string  BMOD2STM        audio/x-mod
> #audio/x-screamtracker-module
> 1080  string  M.K.            audio/x-mod
> #audio/x-protracker-module
> #>0   string  >\0             Title: "%s"
> 1080  string  M!K!            audio/x-mod
> #audio/x-protracker-module
> #>0   string  >\0             Title: "%s"
> 1080  string  FLT4            audio/x-mod
> #audio/x-startracker-module
> #>0   string  >\0             Title: "%s"
> 1080  string  FLT8            audio/x-mod
> #audio/x-startracker-module
> #>0   string  >\0             Title: "%s"
> 1080  string  4CHN            audio/x-mod
> #audio/x-fasttracker-module
> #>0   string  >\0             Title: "%s"
> 1080  string  6CHN            audio/x-mod
> #audio/x-fasttracker-module
> #>0   string  >\0             Title: "%s"
> 1080  string  8CHN            audio/x-mod
> #audio/x-fasttracker-module
> #>0   string  >\0             Title: "%s"
> 1080  string  CD81            audio/x-mod
> #audio/x-oktalyzer-tracker-module
> #>0   string  >\0             Title: "%s"
> 1080  string  OKTA            audio/x-mod
> #audio/x-oktalyzer-tracker-module
> #>0   string  >\0             Title: "%s"
> # Not good enough.
> #1082 string  CH
> #>1080        string  >/0             %.2s-channel Fasttracker "oktalyzer" module sound data
> 1080  string  16CN            audio/x-mod
> #audio/x-taketracker-module
> #>0   string  >\0             Title: "%s"
> 1080  string  32CN            audio/x-mod
> #audio/x-taketracker-module
> #>0   string  >\0             Title: "%s"
>
> # Impuse tracker module (it)
> 0     string          IMPM            audio/x-mod
> #>4   string          >\0             "%s"
> #>40  leshort         !0              compatible w/ITv%x
> #>42  leshort         !0              created w/ITv%x
>
17a98,110
> # xml based formats!
>
> # svg
>
> 0     string          \<?xml
> #                     text/xml
> >38   string          \<\!DOCTYPE\040svg      image/svg+xml
>
>
> # xml
> 0     string          \<?xml                  text/xml
>
>
63a157,158
>
>
103c198
< 0     string          OggS            audio/ogg
---
> 0     string          OggS            application/ogg
386a482,493
> # CDROM Filesystems
> 32769    string    CD001     application/x-iso9660
>
> # Newer StuffIt archives (grant@netbsd.org)
> 0     string          StuffIt                 application/x-stuffit
> #>162 string          >0                      : %s
>
> # BinHex is the Macintosh ASCII-encoded file format (see also "apple")
> # Daniel Quinlan, quinlan@yggdrasil.com
> 11    string  must\ be\ converted\ with\ BinHex\ 4    application/mac-binhex40
> ##>41 string  x                                       \b, version %.3s
>
790a898,907
>
> # Danny Milosavljevic <danny.milo@gmx.net>
> # this are adrift (adventure game standard) game files, extension .taf
> # depending on version magic continues with 0x93453E6139FA (V 4.0)
> # 0x9445376139FA (V 3.90)
> # 0x9445366139FA (V 3.80)
> # this is from source (http://www.adrift.org.uk/) and I have some taf
> # files, and checked them.
> #0       belong          0x3C423FC9
> #>4      belong          0x6A87C2CF application/x-adrift
Comment 2 Miroslav Šulc gentoo-dev 2004-12-14 01:16:55 UTC
Anything new? I have the same problem with file-4.12.
Comment 3 Miroslav Šulc gentoo-dev 2004-12-14 01:39:12 UTC
Just a workaround - I have set path to the Apache magic file for mod_php and this works.
Comment 4 Horst Gutmann 2005-02-04 05:39:43 UTC
I had to additionally enable mime_magic.debug to get it working. Now I at least get some detailed warnings:

PHP Warning:  PHP Startup: : (/usr/share/misc/file/magic.mime:47) '!SCREAM!    audio/x-mod' is not a valid mimetype, entry skipped in Unknown on line 0
PHP Warning:  PHP Startup: : (/usr/share/misc/file/magic.mime:104) 'image/svg+xml' is not a valid mimetype, entry skipped in Unknown on line 0
PHP Warning:  PHP Startup: : (/usr/share/misc/file/magic.mime:187) 'AVI        video/x-msvideo' is not a valid mimetype, entry skipped in Unknown on line 0
PHP Warning:  PHP Startup: : (/usr/share/misc/file/magic.mime:614) 'jP        image/jp2' is not a valid mimetype, entry skipped in Unknown on line 0
PHP Warning:  PHP Startup: : (/usr/share/misc/file/magic.mime:619) 'jp2       image/jp2' is not a valid mimetype, entry skipped in Unknown on line 0
PHP Warning:  PHP Startup: : (/usr/share/misc/file/magic.mime:622) 'M4A       audio/mp4' is not a valid mimetype, entry skipped in Unknown on line 0
PHP Warning:  PHP Startup: : (/usr/share/misc/file/magic.mime:623) 'qt        video/quicktime' is not a valid mimetype, entry skipped in Unknown on line 0
PHP Warning:  PHP Startup: : (/usr/share/misc/file/magic.mime:686) 'Hierarchical Data Format (version 4) data' is not a valid mimetype, entry skipped in Unknown on line 0
PHP Warning:  PHP Startup: : (/usr/share/misc/file/magic.mime:687) 'Hierarchical Data Format (version 5) data' is not a valid mimetype, entry skipped in Unknown on line 0
PHP Warning:  PHP Startup: : (/usr/share/misc/file/magic.mime:762) 'public key block' is not a valid mimetype, entry skipped in Unknown on line 0
PHP Warning:  PHP Startup: : (/usr/share/misc/file/magic.mime:763) 'message' is not a valid mimetype, entry skipped in Unknown on line 0
PHP Warning:  PHP Startup: : (/usr/share/misc/file/magic.mime:764) 'signed message' is not a valid mimetype, entry skipped in Unknown on line 0
PHP Warning:  PHP Startup: : (/usr/share/misc/file/magic.mime:765) 'signature' is not a valid mimetype, entry skipped in Unknown on line 0
PHP Warning:  PHP Startup: : (/usr/share/misc/file/magic.mime:766) 'data' is not a valid mimetype, entry skipped in Unknown on line 0

I've set mime_magic.magicfile to "/usr/share/misc/file/magic.mime".

I'm using sys-apps/file-4.12 and dev-php/php-5.0.3 
Comment 5 SpanKY gentoo-dev 2005-02-06 17:53:02 UTC
looks like a php bug then ... it cant handle the new file formats

once you comment out all the mimetype's php complains about, it 'works':
mime_magic support => enabled
Comment 6 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2005-02-06 17:58:19 UTC
anybody want to take a stab at updating PHP to handle the newer mime format file?
Comment 7 Sebastian Bergmann (RETIRED) gentoo-dev 2005-02-16 04:58:44 UTC
*** Bug 62357 has been marked as a duplicate of this bug. ***
Comment 8 Sebastian Bergmann (RETIRED) gentoo-dev 2005-02-16 04:59:11 UTC
*** Bug 62393 has been marked as a duplicate of this bug. ***
Comment 9 Jude Venn 2005-05-22 04:12:32 UTC
(In reply to comment #6)
> anybody want to take a stab at updating PHP to handle the newer mime format file?

PHP requires the Apache mime magic file *NOT* the file one (see
http://php.net/manual/en/ref.mime-magic.php). That is the reason for this bug,
the ebuild just needs updating to use the apache magic instead of the file one.
Comment 10 Stuart Herbert (RETIRED) gentoo-dev 2005-08-22 00:54:39 UTC
Hi,

mime_content_type() is deprecated in preference to the pecl-fileinfo package. 
We've decided to drop support for mime_content_type().

Best regards,
Stu