[php-src] Issue #20627: Cannot identify some avif images with getimagesize (returns false)

[email protected] (cyberbeat)
Newsgroups php.bugs
Message-ID <oEzoQ8ErKpCWwry9OkKZviCCZTJttkoaCKXT1Y6rcKk@main.internal.php.net>
Issue: https://github.com/php/php-src/issues/20627
Author: cyberbeat

### Description

imagecreatefromavif works

This is output of "heif-info -d"

```
MIME type: image/avif
main brand: avif
compatible brands: mif1, miaf
Box: ftyp ----- (File Type)
size: 24   (header size: 8)
major brand: avif
minor version: 0
compatible brands: mif1,miaf

Box: meta ----- (Metadata)
size: 222   (header size: 12)
| Box: hdlr ----- (Handler Reference)
| size: 33   (header size: 12)
| pre_defined: 0
| handler_type: pict
| name: 
| 
| Box: pitm ----- (Primary Item)
| size: 14   (header size: 12)
| item_ID: 1
| 
| Box: iloc ----- (Item Location)
| size: 30   (header size: 12)
| item ID: 1
|   construction method: 0
|   data_reference_index: 0
|   base_offset: 0
|   extents: 254,59658 
| 
| Box: iinf ----- (Item Information)
| size: 35   (header size: 12)
| | Box: infe ----- (Item Info Entry)
| | size: 21   (header size: 12)
| | item_ID: 1
| | item_protection_index: 0
| | item_type: av01
| | item_name: 
| | hidden item: false
| 
| Box: iref ----- (Item Reference)
| size: 12   (header size: 12)
| 
| Box: iprp ----- (Item Properties)
| size: 86   (header size: 8)
| | Box: ipco ----- (Item Property Container)
| | size: 56   (header size: 8)
| | | index: 1
| | | Box: ispe ----- (Image Spatial Extents)
| | | size: 20   (header size: 12)
| | | image width: 1080
| | | image height: 1080
| | | 
| | | index: 2
| | | Box: av1C -----
| | | size: 12   (header size: 8)
| | | version: 1
| | | seq_profile: 1
| | | seq_level_idx_0: 31
| | | high_bitdepth: 1
| | | twelve_bit: 0
| | | monochrome: 0
| | | chroma_subsampling_x: 0
| | | chroma_subsampling_y: 0
| | | chroma_sample_position: 0
| | | initial_presentation_delay: not present
| | | config OBUs:
| | | 
| | | index: 3
| | | Box: pixi ----- (Pixel Information)
| | | size: 16   (header size: 12)
| | | bits_per_channel: 10,10,10
| | 
| | Box: ipma ----- (Item Property Association)
| | size: 22   (header size: 12)
| | associations for item ID: 1
| | | property index: 1 (essential: false)
| | | property index: 2 (essential: true)
| | | property index: 3 (essential: false)
```

and identify:

```
Format: AVIF (AV1 Image File Format)
  Mime type: image/avif
  Class: DirectClass
  Geometry: 1080x1080+0+0
  Units: Undefined
  Colorspace: sRGB
  Type: TrueColor
  Base type: Undefined
  Endianness: Undefined
  Depth: 10/16-bit
  Channels: 3.0
  Channel depth:
    Red: 16-bit
    Green: 16-bit
    Blue: 16-bit
```

### PHP Version

```plain
PHP 8.4.14 (cli) (built: Oct 23 2025 19:02:50) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.4.14, Copyright (c) Zend Technologies

Also tried 8.4.15
```

### Operating System

Ubuntu 24.04  / Opensuse Tumbleweed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.