Repository navigation
Broader format support and improved MIME compatibility
Version 5.3.0 expands file detection, improves compatibility with MIME names reported by different libmagic versions, and strengthens several container checks.
New and expanded detections
- Images: QOI, DDS, OpenEXR, DjVu, JPEG-LS, and ASCII/binary Netpbm bitmap, graymap and pixmap formats.
- Audio: CAF, AMR-WB, multi-channel AMR/AMR-WB, AAC ADTS and MPEG layer I; improved AIFF-C support.
- Archives and compression: lzop and zlib.
- Executables: 32-bit and universal Mach-O, including 64-bit FAT tables, and specifically identified PE executables.
- Other formats: PCAPNG, nanosecond-resolution PCAP and SketchUp.
MIME compatibility
The complete bundled MIME catalogue has been reviewed against libmagic, shared-mime-info, WebKit and relevant IANA registrations.
MimeTypeAliasesnow recognizes 131 alternate names across 72 format groups, including historical names such asimage/x-ms-bmp,application/x-gzipandapplication/x-debian-package.- Extension lookups resolve equivalent MIME names regardless of which spelling was registered. Results combine matching extensions, remove duplicates and sort them.
- MIME comparisons preserve significant parameter values, including codec identifier case, quoted separators and escaped characters.
- Preferred-name normalization now includes
application/vnd.sqlite3,video/matroskaandimage/jxr.
Specific formats and their broader containers remain distinct. Applications should continue to handle relationships such as Opus/Ogg, APNG/PNG and TTF/OTF/SFNT through their own acceptance policy.
Detection fixes
- Identify AAC and FLAC after ID3 metadata instead of assuming every ID3 tag indicates MP3.
- Reject malformed ID3 lengths and reserved MPEG header fields; prevent UTF-16 text from matching loose MPEG signatures.
- Locate Ogg codec identifiers using the page’s segment table.
- Parse Matroska/WebM document types within bounded EBML headers, supporting variable-width sizes and rejecting misplaced markers or malformed elements.
- Require an AIFF or AIFC form identifier when detecting AIFF audio.
- Identify Apple disk images using the UDIF trailer; recognize ordinary zlib streams separately.
- Require SQLite’s complete signature.
- Distinguish universal Mach-O binaries from Java class files.
- Correct MP4 extension mappings to
audio/mp4andvideo/mp4.
Upgrade notes
Review MIME allowlists and extension-dependent handling for these corrected results:
| Format | Detection result in 5.3.0 |
|---|---|
| Identified PE executable | application/vnd.microsoft.portable-executable |
| JPEG-LS | image/jls |
| AAC ADTS, including after ID3 metadata | audio/aac, extension aac |
| FLAC after ID3 metadata | audio/x-flac |
| MPEG layer I | audio/mpeg, extension mp1 |
| zlib stream | application/zlib |
Other MZ files retain application/x-msdownload. Adding mp1 also makes it the first extension returned when looking up audio/mpeg.
Development and verification
- Added 28 fixtures, provenance records, reproducible media generators and malformed-input regressions.
- Added a development tool for comparing fixture results with local
fileinfo. - Added
composer formatandcomposer format-check, with formatting checks in CI. - Verified with 1,089 tests and 4,097 assertions, plus passing CI on PHP 8.1–8.6.
Runtime requirements remain PHP 8.1+ and ext-ctype; ext-zip remains optional. No additional runtime dependencies were introduced.
Full Changelog: 5.2.0...5.3.0