[php-maint] Inconsistency between mime-support, shared-mime-info and file for PHP files media types.

Charles Plessy plessy at debian.org
Wed Aug 29 22:16:41 UTC 2012


[Copy sent to maintainers of mime-support, shared-mime-info, file and php5, as
 an invitation to participate to the discussion.]

Le Sun, Aug 26, 2012 at 01:27:51PM -0700, Ben Hutchings a écrit :
> On Sun, 2012-08-26 at 19:55 +0200, Christoph Anton Mitterer wrote:
> > 
> > With things like SVG it's quite tricky,... SVG has "application/" (as
> > most XML types will have)... the reason probably, that it's interpreted
> > into "drawing commands".
> 
> I think the reason is that SVG is not usually read or written using
> generic text tools.  Similarly the X bitmap type is image/x-xbitmap and
> not text/x-xbitmap, even though it can be read as ASCII text.  (A new
> top-level type like 'vector' would have been better though.)

Hello everybody,

note that to solve the problem caused by interpreted files being sometimes seen
as application (or image) and sometimes seen as plain text, the FreeDesktop
Shared MIME-info Database specification introduces a new concept, "subclassing".

  A type is a subclass of another type if any instance of the first type is
  also an instance of the second. For example, all image/svg files are also
  text/xml, text/plain and application/octet-stream files. Subclassing is about
  the format, rather than the category of the data (for example, there is no
  'generic spreadsheet' class that all spreadsheets inherit from). 

http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-latest.html#subclassing

In the case of unregistered media types, nothing prevents parallel systems to
report inconsistent information.  This is what happens with PHP.

 * mime-support does not associate .php files with media type anymore, although
   text/x-php and application/x-php have been proposed.

 * shared-mime-info has application/x-php as a subtype of text/plain.

 * file has text/x-php for files that start by <?\n or <?php.

If members of the upstream PHP community read this, how about standardising
throuhg the IANA, or if this was alredy proposed and rejected, at least through
a recommendation on the PHP web site ?

Have a nice day,

-- 
Charles Plessy
Tsurumi, Kanagawa, Japan



More information about the pkg-php-maint mailing list