|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77990 The mime should be image/x-ms-bmp, not image/bmp in getimagesize function
Submitted: 2019-05-08 08:55 UTC Modified: 2019-05-08 09:32 UTC
From: peter279k at gmail dot com Assigned: cmb (profile)
Status: Not a bug Package: GetImageSize related
PHP Version: 7.3.5 OS: Ubuntu 16.04.6 LTS
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: peter279k at gmail dot com
New email:
PHP Version: OS:


 [2019-05-08 08:55 UTC] peter279k at gmail dot com
The getimagesize function mime result should be enhanced.

The mime content type should be image/x-ms-bmp, not image/bmp.

Test script:

echo mime_content_type('php.bmp') . "\n";
echo getimagesize('php.bmp')['mime'] . "\n";

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2019-05-08 09:11 UTC] spam2 at rhsoft dot net
no, it should not because the x/- stuff is temporary / not standarized
Internet media type image/bmp, image/x-bmp
 [2019-05-08 09:18 UTC] 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:21 UTC] spam2 at rhsoft dot net
because is part of the fileinfo extension and is part of the gd extension which are completly different worlds
 [2019-05-08 09:28 UTC] peter279k at gmail dot com
To, 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:30 UTC] spam2 at rhsoft dot net
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
 [2019-05-08 09:32 UTC]
-Status: Open +Status: Not a bug -Package: Output Control +Package: GetImageSize related -Assigned To: +Assigned To: cmb
 [2019-05-08 09:32 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

The change to getimagesize() is documented in the migration
guide[1].  The fact that mime_content_type() still returns the
obsolete mime type should be reported against upstream[2].

[1] <>
[2] <>
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Apr 18 06:01:23 2021 UTC