Skip to content

IMAGETYPE_SVG constant on standard extension and source code #20087

@llaville

Description

@llaville

Description

While testing PHP 8.5.0RC1 on context of my project https://github.com/llaville/php-compatinfo-db, I've noticed that PHP standard extension provide a IMAGETYPE_SVG constant, but we cannot find any implementation on GH repo
(except in a test file: https://github.com/php/php-src/blob/6872cf2eef921b9d27fa300ca5a7ad3bc27aee1c/ext/libxml/tests/image/imagetype_svg.phpt)

And so the implementation came from commit 0962c32#diff-8957f0eefb83e6c580f2fc6f40c9033d68ac478fd43bab0610ab382e13908829

Search for : https://github.com/search?q=repo%3Aphp%2Fphp-src%20IMAGETYPE_S&type=code

The following code:

php --re standard | grep IMAGETYPE_

Resulted in this output:

    Constant [ <persistent> int IMAGETYPE_GIF ] { 1 }
    Constant [ <persistent> int IMAGETYPE_JPEG ] { 2 }
    Constant [ <persistent> int IMAGETYPE_PNG ] { 3 }
    Constant [ <persistent> int IMAGETYPE_SWF ] { 4 }
    Constant [ <persistent> int IMAGETYPE_PSD ] { 5 }
    Constant [ <persistent> int IMAGETYPE_BMP ] { 6 }
    Constant [ <persistent> int IMAGETYPE_TIFF_II ] { 7 }
    Constant [ <persistent> int IMAGETYPE_TIFF_MM ] { 8 }
    Constant [ <persistent> int IMAGETYPE_JPC ] { 9 }
    Constant [ <persistent> int IMAGETYPE_JP2 ] { 10 }
    Constant [ <persistent> int IMAGETYPE_JPX ] { 11 }
    Constant [ <persistent> int IMAGETYPE_JB2 ] { 12 }
    Constant [ <persistent> int IMAGETYPE_SWC ] { 13 }
    Constant [ <persistent> int IMAGETYPE_IFF ] { 14 }
    Constant [ <persistent> int IMAGETYPE_WBMP ] { 15 }
    Constant [ <persistent> int IMAGETYPE_JPEG2000 ] { 9 }
    Constant [ <persistent> int IMAGETYPE_XBM ] { 16 }
    Constant [ <persistent> int IMAGETYPE_ICO ] { 17 }
    Constant [ <persistent> int IMAGETYPE_WEBP ] { 18 }
    Constant [ <persistent> int IMAGETYPE_AVIF ] { 19 }
    Constant [ <persistent> int IMAGETYPE_HEIF ] { 20 }
    Constant [ <persistent> int IMAGETYPE_UNKNOWN ] { 0 }
    Constant [ <persistent> int IMAGETYPE_COUNT ] { 22 }
    Constant [ <persistent> int IMAGETYPE_SVG ] { 21 }

Can we have a clarification on this subject please ?

PHP Version

PHP 8.5.0RC1 (cli) (built: Sep 26 2025 21:38:33) (NTS)
Copyright (c) The PHP Group
Built by https://github.com/docker-library/php
Zend Engine v4.5.0RC1, Copyright (c) Zend Technologies
    with Zend OPcache v8.5.0RC1, Copyright (c), by Zend Technologies

Operating System

Ubuntu 22.04 LTS

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions