Skip to content

Conversation

@rodrigoprimo
Copy link
Contributor

This PR adds two missing IMAGETYPE_* constants found while working on PHPCompatibility/PHPCompatibilityWP#88.

PHP 8.1 | NewConstants: add missing IMAGETYPE_AVIF constant

The IMAGETYPE_AVIF constant was introduced in PHP 8.1 as part of AVIF image support for getimagesize() and imagecreatefromstring().

Refs:

Related to #1299

PHP 8.5 | NewConstants: add IMAGETYPE_HEIF constant

The IMAGETYPE_HEIF constant was introduced in PHP 8.5 as part of HEIF/HEIC image support for getimagesize().

Refs:

Related to #1849

Copy link
Member

@jrfnl jrfnl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR @rodrigoprimo !

And well done not adding the gd extension (as, while the name is misleading, these constants are actually part of PHP standard (Core)).


It looks like both constants are missing from the respective UPGRADING files in PHP itself.

While I imagine a PR to PHP 8.1 will no longer be accepted, I would like to suggest to you to submit a PR to the PHP 8.5 branch to update the UPGRADING file with a mention of this new constant.
Ref: https://github.com/php/php-src/blob/PHP-8.5/UPGRADING

I would also like to suggest creating a PR to update the PHP 8.1 and the PHP 8.5 migration guides as those are missing mentions of these constants too:

Copy link
Member

@jrfnl jrfnl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rodrigoprimo Thanks for the update. Could you please squash those code style fixes into the correct original commits ?

The IMAGETYPE_AVIF constant was introduced in PHP 8.1 as part of AVIF image support for getimagesize() and imagecreatefromstring().

Refs:
* https://www.php.net/manual/en/image.constants.php#constant.imagetype-avif
* php/php-src@cee33ba
* php/php-src 7091

Related to 1299
The IMAGETYPE_HEIF constant was introduced in PHP 8.5 as part of HEIF/HEIC image support for getimagesize().

Refs:
* php/php-src@dfac2da
* php/php-src 18940

Related to 1849
@jrfnl jrfnl merged commit e2be32d into PHPCompatibility:develop Dec 15, 2025
63 of 64 checks passed
@rodrigoprimo rodrigoprimo deleted the add-missing-constants branch December 15, 2025 18:47
@rodrigoprimo
Copy link
Contributor Author

Thanks for the review, @jrfnl!

It looks like both constants are missing from the respective UPGRADING files in PHP itself.
I would also like to suggest creating a PR to update the PHP 8.1 and the PHP 8.5 migration guides as those are missing mentions of these constants too:

I went ahead and created the PRs you suggested:

php/php-src#20713
php/doc-en#5042
php/doc-en#5043

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants