Bug #79681 [Com]: mime_content_type/finfo returning incorrect mimetype
Edit report at https://bugs.php.net/bug.php?id=79681&edit=1
ID: 79681
Comment by: jamier105+php at gmail dot com
Reported by: xandros92 at gmail dot com
Summary: mime_content_type/finfo returning incorrect mimetype
Status: Closed
Type: Bug
Package: *Directory/Filesystem functions
Operating System: Windows 10 1909
PHP Version: 7.4.6
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Please can this bug be reopened and checked again as I can recreate it using PHP 7.4.12:
$ php7.3 -v
PHP 7.3.24-3+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Oct 31 2020 16:59:59) ( NTS )
Copyright (c) 1997-2018 The PHP Group
$ php7.3 -r 'echo finfo_file(finfo_open(), __DIR__ . "/my_file.mp3", FILEINFO_MIME).
"\n";'
audio/mpeg; charset=binary
$ php7.4 -v
PHP 7.4.12 (cli) (built: Oct 31 2020 17:04:09) ( NTS )
Copyright (c) The PHP Group
$ php7.4 -r 'echo finfo_file(finfo_open(), __DIR__ . "/my_file.mp3", FILEINFO_MIME).
"\n";'
application/x-font-gdos; charset=binary
An example file can be provided if needed.
Thanks.
Previous Comments:
------------------------------------------------------------------------
[2020-06-10 14:41:41] cmb@php.net
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=6747068ce716ca9e458b245489086d7ff13109b9
Log: Fix #79681: mime_content_type/finfo returning incorrect mimetype
------------------------------------------------------------------------
[2020-06-09 13:49:45] cmb@php.net
Thanks for the samples!
I can confirm the behavior. Reporting the .xml.gz as
application/gzip is actually an improvement, since this mime type
is registered[1]. Reporting the .mp3 as application/x-font-gdos is
obviously wrong, and has been fixed[2] for file 5.38.
[1] <https://www.iana.org/assignments/media-types/media-types.xhtml>
[2] <https://github.com/file/file/commit/5a55569a35eff686d4b7400b219d380f7c622890>
------------------------------------------------------------------------
[2020-06-09 10:06:52] xandros92 at gmail dot com
https://drive.google.com/drive/folders/1NZ48AWys6pTTvbfOoiEHXP2rLL93Tmjy?usp=sharing
------------------------------------------------------------------------
[2020-06-08 12:33:58] cmb@php.net
Can you please make sample.xml.gz and sample.mp3 available for download?
------------------------------------------------------------------------
[2020-06-08 11:19:20] xandros92 at gmail dot com
Description:
------------
After change php version from 7.3 and 7.2 to 7.4, some applications failed validation uploaded files
on mimetype. The problem exist with some audio/mpeg and application/x-gzip.
Test script:
---------------
echo finfo_file(finfo_open(), __DIR__ . '/sample.xml.gz', FILEINFO_MIME);
echo finfo_file(finfo_open(), __DIR__ . '/sample.mp3, FILEINFO_MIME);
Expected result:
----------------
application/x-gzip; charset=binary
audio/mpeg; charset=binary
Actual result:
--------------
application/gzip; charset=binary
application/x-font-gdos; charset=binary
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=79681&edit=1
Thread (10 messages)