Skip to content

Conversation

@cmb69
Copy link
Member

@cmb69 cmb69 commented Aug 3, 2017

Finally, an official media type for Windows BMP files has been
registered with the IANA, so we change getimagesize.phpt() and
related functions to report this media type instead of image/x-ms-bmp.

Finally, an official media type for Windows BMP files has been
registered with the IANA, so we change `getimagesize.phpt()` and
related functions to report this media type instead of `image/x-ms-bmp`.
@cmb69
Copy link
Member Author

cmb69 commented Aug 3, 2017

I'm not sure whether this can go to PHP 7.3 due to the BC break. OTOH, still reporting image/x-ms-bmp might be regarded as bug.

@krakjoe krakjoe added the Feature label Aug 4, 2017
@cmb69
Copy link
Member Author

cmb69 commented Aug 13, 2017

Since there have not been any objections, I'm going to merge.

@php-pulls php-pulls merged commit 32a6e1c into php:master Aug 13, 2017
@cmb69 cmb69 deleted the bmp-mime-type branch August 13, 2017 19:25
@DanielRuf
Copy link
Contributor

DanielRuf commented Apr 24, 2025

A small observation from my side, until PHP 8.3 the finfo_file still returned image/x-ms-bmp.

https://www.php.net/manual/en/migration73.incompatible.php mentions only the change for getimagesize.

PHP 8.2 (image/x-ms-bmp)
https://github.com/DanielRuf/test-php-mimetype/actions/runs/14642168239/job/41086982465#step:4:31

image

PHP 8.3 (image/bmp)
https://github.com/DanielRuf/test-php-mimetype/actions/runs/14642207425/job/41087114973#step:4:31

image

 .github/workflows/php.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml
index e82d55a..e7e338d 100644
--- a/.github/workflows/php.yml
+++ b/.github/workflows/php.yml
@@ -17,7 +17,7 @@ jobs:
     steps:
     - uses: shivammathur/setup-php@v2
       with:
-        php-version: 8.2
+        php-version: 8.3.0
     - uses: actions/checkout@v4
 
     - name: Get mimetype
name: PHP Mimetype Test

on:
  push:
    branches: [ "main" ]
  pull_request:
    branches: [ "main" ]

permissions:
  contents: read

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: shivammathur/setup-php@v2
      with:
        php-version: 8.3.0
    - uses: actions/checkout@v4

    - name: Get mimetype
      run: 
        |
        wget https://samples-files.com/samples/images/bmp/480-360-sample.bmp
        php -r '$fileInfo = new finfo(); echo $fileInfo->file("480-360-sample.bmp", FILEINFO_MIME_TYPE);'

Is there some information regarding this change?

@cmb69
Copy link
Member Author

cmb69 commented Apr 24, 2025

A small observation from my side, until PHP 8.3 the finfo_file still returned image/x-ms-bmp.

fileinfo is a different beast; this is using libmagick under the hood; apparently the behavioral change has been introduce by them (might be a bug; might have been fixed in the meantime; we may or may not want to backport a potentially available fix).

@DanielRuf
Copy link
Contributor

DanielRuf commented Apr 24, 2025

Understood, thank you.

fileinfo is a different beast

I expected this a bit when I saw the commits at https://github.com/php/php-src/commits/master/ext/fileinfo/libmagic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants