#64322 closed defect (bug) (fixed)
PHP 8.5: HEIF/HEIC support added to `getimagesize()`
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 6.9 | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Media | Keywords: | php php85 has-patch dev-feedback fixed-major |
| Focuses: | php-compatibility | Cc: |
Description
Parent ticket for all things PHP 8.5: #63061.
PHP 8.5 added support for the HEIF/HEIC image format (relevant commit).
A version of Imagick was released with PHP 8.5 support, so it was recently added to the WPDev Docker images.
As a result, Tests_Functions::test_wp_getimagesize_heic() is now failing.
Change History (14)
This ticket was mentioned in PR #10568 on WordPress/wordpress-develop by @desrosj.
4 months ago
#1
- Keywords has-patch added
@adamsilverstein commented on PR #10568:
4 months ago
#3
The test update looks good here, thanks @desrosj! I didn't realize PHP was adding HEIC/F support, we probably need to update some of the core handling of these uploads as well.
@adamsilverstein commented on PR #10568:
4 months ago
#4
Looks good with the changes to the constant name suggested above.
@adamsilverstein commented on PR #10568:
4 months ago
#5
... need to update some of the core handling of these uploads as well.
Actually existing core handling works fine: when getimagesize works correctly with heic/f images, wp_getimagesize returns early with the correct information (as the test demonstrates).
@desrosj commented on PR #10568:
4 months ago
#6
I considered whether we should preserve the IMAGETYPE_HEIC constant, but a search of the (outdated) plugin directory showed 0 occurrences of that constant. So I don't think it's worth it.
#8
@
4 months ago
- Keywords commit dev-feedback fixed-major added
- Resolution fixed deleted
- Status changed from closed to reopened
Reopening for backport consideration of [61328].
#9
follow-up:
↓ 11
@
4 months ago
How come this issue only popped up now? What happens if 6.9 doesn't include this change? Are there more things that could pop up? I read through the ticket/PR but I don't have a lot of context sorry.
#11
in reply to:
↑ 9
@
4 months ago
Replying to ellatrix:
How come this issue only popped up now?
This failure was caused by the change to the PHP Docker containers (that the PHPUnit tests run inside of and we we maintain) on November 29, that updated the 8.5 image to use PHP 8.5.0 instead of PHP 8.5.0RC5, and the Imagick extension was added.
This meant that any new PHPUnit Test workflow that ran from that point forward would run with the new containers. I am not sure why this surfaced in 8.5.0 GA and not in 8.5.0 RC5. But this change to the upstream containers caused it for some reason.
What happens if 6.9 doesn't include this change?
If this is not merged into 6.9, then the unit tests will continue to fail. But I don't think there will be any noticeable impact otherwise because getimagesize() will just return the image size data, just with more than expected. Though I think it's preferable to include because it ensures the image type constant is consistent with the one added to PHP core for the release.
Are there more things that could pop up?
It's possible, but I think the risk is very minimal. I searched the plugin directory, and while that site is a bit out of date, there was not one reference to the constant being changed in [61328].
The scenario where someone may encounter an issue is if code is explicitly checking for the previous value of 99. Something like this:
$image_size = wp_getimagesize( $filename );
if ( '99' == $image_size[2] ) {
// Do something HEIF/HEIC related.
}
I searched for usage of wp_getimagesize() and found 91 results. But none of those results are performing any logic checks using IMAGETYPE_HEIC or IMAGETYPE_HEIF.
Trac ticket: Core-64322