Bug #77990 [Com]: The mime should be image/x-ms-bmp, not image/bmp in getimagesize function
| From: | spam2 at rhsoft dot net | Date: | Wed, 08 May 2019 09:30:33 +0000 |
| Subject: | Bug #77990 [Com]: The mime should be image/x-ms-bmp, not image/bmp in getimagesize function | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-220776@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=77990&edit=1
ID: 77990
Comment by: spam2 at rhsoft dot net
Reported by: peter279k at gmail dot com
Summary: The mime should be image/x-ms-bmp, not image/bmp in
getimagesize function
Status: Open
Type: Bug
Package: Output Control
Operating System: Ubuntu 16.04.6 LTS
PHP Version: 7.3.5
Block user comment: N
Private report: N
New Comment:
PHP does nothing here, it calls libraries and depending on the library version you get the old x-
stuff or the finalized mime-type - you are supposed to know the valid results in your code and test
against both
Previous Comments:
------------------------------------------------------------------------
[2019-05-08 09:28:04] peter279k at gmail dot com
To spam2@rhsoft.net, according to the wiki you provide, it seems that the BMP has two internet mime
content type.
They will be image/bmp, or image/x-bmp.
Shouldn't we consider/concern this?
And make this consistency or add some messages on official PHP doc?
------------------------------------------------------------------------
[2019-05-08 09:21:14] spam2 at rhsoft dot net
because https://www.php.net/manual/en/function.mime-content-type.php
is part of the fileinfo extension and https://www.php.net/manual/en/function.getimagesize.php
is part of the gd extension which are completly different worlds
------------------------------------------------------------------------
[2019-05-08 09:18:40] peter279k at gmail dot com
I wonder why the mime content type has different result for mime_content_type and getimagesize
functions?
------------------------------------------------------------------------
[2019-05-08 09:11:12] spam2 at rhsoft dot net
no, it should not because the x/- stuff is temporary / not standarized
https://en.wikipedia.org/wiki/BMP_file_format
Internet media type image/bmp, image/x-bmp
------------------------------------------------------------------------
[2019-05-08 08:55:08] peter279k at gmail dot com
Description:
------------
The getimagesize function mime result should be enhanced.
The mime content type should be image/x-ms-bmp, not image/bmp.
Test script:
---------------
<?php
echo mime_content_type('php.bmp') . "\n";
echo getimagesize('php.bmp')['mime'] . "\n";
Expected result:
----------------
image/x-ms-bmp
image/x-ms-bmp
Actual result:
--------------
image/x-ms-bmp
image/bmp
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=77990&edit=1