You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
AVIF images misdetected as HEIF after introducing HEIF support in getimagesize() #20201
After commit dfac2da PHP incorrectly detects certain AVIF files as HEIF.
The issue arises because both formats use the same ISOBMFF (.heif) container and share the mif1 major brand.
Current PHP logic checks only the major_brand and stops, even when the compatible_brands list includes avif.
PHP 8.5.0RC2 (cli) (built: Oct 8 2025 09:46:31) (NTS)
Copyright (c) The PHP Group
Built by Alpine Linux aports
Zend Engine v4.5.0RC2, Copyright (c) Zend Technologies
with Zend OPcache v8.5.0RC2, Copyright (c), by Zend Technologies
changed the title [-]AVIF images misdetected as HEIF after introducing HEIF support in GD[/-][+]AVIF images misdetected as HEIF after introducing HEIF support in getimagesize()[/+]on Oct 18, 2025
I asked community about license and as it's a part of core and is not exposed as images in demo sites it should be gpl2+ so could be reused, demo images are bundled using CC share-alike 2
I see. Thanks for getting back to me.
I don't believe we can embed GPL stuff in PHP. However, based on your description, I managed to craft my own reproducer image (with a little help of a hex editor to override ftyp).
I went back to the original issue that added the images, it was https://www.drupal.org/node/373613 in 2009. @quicksketch created the images for that issue, so this means they're GPL and e.g. weren't originally elsewhere with a different license.
@quicksketch is still around and we could ask him to dual-license the images as something else for PHP (IANAL etc. but I'm guessing something like that would be enough). But if you're able to create your own versions that might be quicker.
As the sole author of that original image, I would be more than happy to re-license / dual license. I don't think there is any embedded license information. But I give my full permission. LMK if you need anything from me.
Thanks for jumping in! In the meantime I had already managed to construct a reproducer based on the descriptions given. I'll keep in mind for the future who to contact if we ever need to check in a sample reproducer. Thanks!
Activity
andypost commentedon Oct 17, 2025
test-avif.zip
the testing file (zipped as GH does not accept it
the source is https://git.drupalcode.org/project/drupal/-/blob/11.x/core/tests/fixtures/files/img-test.avif
andypost commentedon Oct 17, 2025
Drupal issue is https://www.drupal.org/project/drupal/issues/3540531
andypost commentedon Oct 17, 2025
fixed test script
[-]AVIF images misdetected as HEIF after introducing HEIF support in GD[/-][+]AVIF images misdetected as HEIF after introducing HEIF support in getimagesize()[/+]ndossche commentedon Oct 18, 2025
There's also the "stupid but simple" way to fix this:
ndossche commentedon Oct 18, 2025
@andypost What is the license of that test image? I'm asking so I know if we are allowed to check it into the php-src repo.
andypost commentedon Oct 19, 2025
I asked community about license and as it's a part of core and is not exposed as images in demo sites it should be gpl2+ so could be reused, demo images are bundled using CC share-alike 2
Originally it was added in https://www.drupal.org/project/drupal/issues/3202016 using imagick from png file
ndossche commentedon Oct 19, 2025
I see. Thanks for getting back to me.
I don't believe we can embed GPL stuff in PHP. However, based on your description, I managed to craft my own reproducer image (with a little help of a hex editor to override
ftyp).Fix phpGH-20201: AVIF images misdetected as HEIF after introducing HE…
catch56 commentedon Oct 20, 2025
I went back to the original issue that added the images, it was https://www.drupal.org/node/373613 in 2009. @quicksketch created the images for that issue, so this means they're GPL and e.g. weren't originally elsewhere with a different license.
@quicksketch is still around and we could ask him to dual-license the images as something else for PHP (IANAL etc. but I'm guessing something like that would be enough). But if you're able to create your own versions that might be quicker.
quicksketch commentedon Oct 20, 2025
As the sole author of that original image, I would be more than happy to re-license / dual license. I don't think there is any embedded license information. But I give my full permission. LMK if you need anything from me.
ndossche commentedon Oct 20, 2025
Thanks for jumping in! In the meantime I had already managed to construct a reproducer based on the descriptions given. I'll keep in mind for the future who to contact if we ever need to check in a sample reproducer. Thanks!
Merge branch 'PHP-8.5'
Fix GH-20201: AVIF images misdetected as HEIF after introducing HEIF …
andypost commentedon Oct 31, 2025
Thank you! Now tests passed and only image interpolation tests needs tuning for the new release