Bug #68916 [Com]: Mime Type for some jpeg files not detected correctly
| From: | rtrtrtrtrt at dfdfdfdf dot dfd | Date: | Wed, 18 Nov 2020 16:23:49 +0000 |
| Subject: | Bug #68916 [Com]: Mime Type for some jpeg files not detected correctly | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-230444@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=68916&edit=1
ID: 68916
Comment by: rtrtrtrtrt at dfdfdfdf dot dfd
Reported by: uwej711 at gmail dot com
Summary: Mime Type for some jpeg files not detected correctly
Status: Feedback
Type: Bug
Package: Filesystem function related
Operating System: Ubuntu 14.04
PHP Version: 5.5.9
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
> libmagic is compiled into PHP, but not the magic file
this is not true at all!
with some luck (systems magic and the bundeled compatible) you can even re-generate the responsible
file with "php -d 'display_errors=0' ext/fileinfo/create_data_file.php
/usr/share/misc/magic.mgc > ext/fileinfo/data_file.c" at build time
Previous Comments:
------------------------------------------------------------------------
[2020-11-18 15:53:42] cmb@php.net
> There is currently no way to work around this as the magic file
> is compiled into php
libmagic is compiled into PHP, but not the magic file.
> This is only fixed in libmagic 5.18, [â¦]
So this should be fixed for any of the actively supported PHP
versions[1].
[1] <https://www.php.net/supported-versions.php>
------------------------------------------------------------------------
[2015-01-27 08:24:01] uwej711 at gmail dot com
to reproduce:
<?php
$finfo = finfo_open(FILEINFO_MIME_TYPE); // return mime type ala mimetype extension
echo finfo_file($finfo, 'test.jpg') . "\n";
finfo_close($finfo);
?>
and the jpeg from
https://bugs.debian.org/cgi-bin/bugreport.cgi?msg=5;filename=TESTp.jpg;att=1;bug=657545
------------------------------------------------------------------------
[2015-01-26 14:07:10] uwej711 at gmail dot com
Sorry this is the correct patch link:
https://github.com/file/file/commit/7e21b5477712cedf70403624d705c6cd7656a780
This bug also affects the latest 5.6.5 version
------------------------------------------------------------------------
[2015-01-26 14:04:20] uwej711 at gmail dot com
Description:
------------
There are some jpegs that are detected as Linux/i386 core file. This is only fixed in libmagic 5.18,
currently php uses 5.17. See https://github.com/file/file/commit/7e21b5477712cedf70403624d705c6cd7656a780for
the change in libmagic.
There is currently no way to work around this as the magic file is compiled into php
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=68916&edit=1