Bug #79045 [Com]: Incorrect svg mimetypes detected

From: Date: Wed, 25 Mar 2020 14:47:26 +0000
Subject: Bug #79045 [Com]: Incorrect svg mimetypes detected
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-226262@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79045&edit=1

 ID:                 79045
 Comment by:         magnar at myrtveit dot com
 Reported by:        sloth at 0k dot vc
 Summary:            Incorrect svg mimetypes detected
 Status:             Open
 Type:               Bug
 Package:            Filesystem function related
 Operating System:   Centos 7.5
 PHP Version:        7.2.26
 Block user comment: N
 Private report:     N

 New Comment:

I also experienced this annoying issue today. Here is a very simple reproduction: https://3v4l.org/K2jqo


Previous Comments:
------------------------------------------------------------------------
[2019-12-30 23:25:11] bugreports at gmail dot com

sadly php has it#s own fork of file-libs
in theory you can rebuild "data_file.c"

in reality this works until the distribution has a to new file-libs and in that case the command
suceeds but the resulting php binary is unusable

php ext/fileinfo/create_data_file.php /usr/share/misc/magic.mgc > ext/fileinfo/data_file.c

------------------------------------------------------------------------
[2019-12-30 23:20:49] phpbugs-xap2kka at mpan dot pl

But on sloth’s system file returns a value different than PHP does. This is the
primary reason for re-opening and claiming it to be a PHP bug, as far as I understand.
Shouldn’t they both agree on a single system?

------------------------------------------------------------------------
[2019-12-30 12:20:26] cmb@php.net

The result depends on the version of the magic data; for vanilla
file:

as of file 5.38: image/svg+xml
as of file 5.29: image/svg
former versions: text/plain

Note that file 5.38 has been released only two weeks ago, and that
we certainly won't switch back to the pre file 5.29 behavior.

Also note that active support for PHP 7.2 has ended one month
ago[1], so any fix for this could only go into PHP 7.3.

[1] <https://www.php.net/supported-versions.php>

------------------------------------------------------------------------
[2019-12-30 02:03:51] phpbugs-xap2kka at mpan dot pl

“With PHP 7.4.1 *it* returns the same, *but* file 5.37 (on Arch) offers a different
output” of course. Too many bugs. :)

------------------------------------------------------------------------
[2019-12-30 02:01:36] phpbugs-xap2kka at mpan dot pl

With PHP 7.4.1 returns the same, bug file 5.37 (on Arch) offers a different output:

Test.svg:  image/svg+xml; charset=utf-8
badge.svg: image/svg; charset=us-ascii

That doesn’t explain, however, why is PHP 7.2.26 returning a different value and why
“image/svg” is returned instead of “image/svg+xml”. I do understand that
badge.svg is not an XML file and one may be tempted to remove that “+xml”, but if it is
not an XML, it is also not an SVG and “image/svg” is equally incorrect. Plus it is not the
registered type for SVG.

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=79045


--
Edit this bug report at https://bugs.php.net/bug.php?id=79045&edit=1


Thread (12 messages)

« previous php.bugs (#226262) next »