#56817 closed defect (bug) (fixed)
Investigate new test failure in PHP 8.2
Reported by: | desrosj | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 6.2 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Build/Test Tools | Keywords: | php82 has-patch has-unit-tests |
Focuses: | Cc: |
Description
There's a new unit test failure being reported on PHP 8.2 all of a sudden.
There was 1 failure: 1) Tests_Functions::test_wp_check_filetype_and_ext_with_filtered_woff Failed asserting that two arrays are identical. --- Expected +++ Actual @@ @@ Array &0 ( - 'ext' => 'woff' - 'type' => 'application/font-woff' + 'ext' => false + 'type' => false 'proper_filename' => false ) /var/www/tests/phpunit/tests/functions.php:1428 /var/www/vendor/bin/phpunit:123
After some investigation, this seems to be caused by the PHP 8.2 Docker container used during testing.
The containers are usually rebuilt weekly on Sunday, ensuring the latest point releases (or beta/RC versions in this case) are used. Unfortunately, GitHub disables workflows that run on schedule
when a repository does not have activity for a period of time, so this had not run since August 27th.
After re-enabling the workflow, the containers were rebuilt and pushed. This updated the version of PHP 8.2 from beta 3 to RC3.
The timing also lines up. The first failure occurred approximately 1.5 hours after the containers were updated.
Something changed between 8.2.0beta3
and 8.2.0RC3
that's causing this failure.
Attachments (3)
Change History (30)
#2
@
2 years ago
For cross-reference, I've experienced this bug in this PR meant for WordPress 6.1 RC2, https://github.com/WordPress/wordpress-develop/actions/runs/3241375868/jobs/5314643672
There's also other failures. I'm not sure if all of them stem from the same issue, but wanted to share, so it's documented.
#3
@
2 years ago
As a temporary measure to prevent PRs/patches/commits being blocked, I'd like to suggest adding a selective (PHP 8.2 only) $this->markTestSkipped()
at the top of the test with a link to this issue.
This issue can then stay open to investigate this in more depth and determine whether this is a test issue or a src issue.
#5
@
2 years ago
56817.diff fixes the test failure in PHP 8.2, but will cause a failure in all other versions. But at least the problem is more clear now.
I think skipping temporarily is fine for now.
#6
@
2 years ago
56817-skip.2.diff looks good to me as a temporary measure 👍
#7
@
2 years ago
Since woff
is not an extension supported by core by default, I guess the question for further discussion is, should it be up to plugins to adjust $types['woff'] = 'application/font-woff';
based on the PHP version, or should core provide backward compatibility for that?
#8
@
2 years ago
@desrosj Please add a comment with a link to this ticket to the 56817-skip.2.diff
patch. Other than that looks good.
#9
@
2 years ago
Also - I previously identified a similar issue with mimetypes for webp
on PHP 5.6 (and 7.0 I think). This was not solved yet and there is a draft PR which has more (debug) info available: https://github.com/WordPress/wordpress-develop/pull/2453
Note: all the test + documentation improvements in that PR have been committed in the mean time, it's only the debug commits which still remain. Hmm.. maybe I should rebase it at some point to make it clearer what I was debugging there.
#11
@
2 years ago
- Milestone changed from 6.1 to 6.2
Moving this to 6.2 as it's not something that will be fixed for 6.1.
#15
follow-up:
↓ 17
@
20 months ago
Changing the filter_mime_types_woff()
callback in the tests to this makes the test pass on PHP 7.4/8.2:
<?php if ( PHP_VERSION_ID >= 80200 ) { $mimes['woff'] = 'font/woff'; } else { $mimes['woff'] = 'application/font-woff'; } return $mimes;
However, as noted in comment:13, on PHP 8.1, success will depend on the version of the fileinfo
extension.
What is the currently thinking about the desirable end goal?
- That the accurate PHP/fileinfo-dependent type is returned (
application/font-woff
vsfont/woff
)? Or - That Core returns a consistent type across all PHP/fileinfo versions (
application/font-woff
)?
This ticket was mentioned in Slack in #core by costdev. View the logs.
20 months ago
#17
in reply to:
↑ 15
@
20 months ago
Replying to costdev:
What is the currently thinking about the desirable end goal?
- That the accurate PHP/fileinfo-dependent type is returned (
application/font-woff
vsfont/woff
)?
I think this would be the preferred result here. Let's adjust the tests as needed.
- Or that Core returns a consistent type across all PHP/fileinfo versions (
application/font-woff
)?
Returning a consistent type sounds good in theory, but if it was changed to font/woff
upstream, introducing a discrepancy with that change doesn't seem worth it.
#18
@
20 months ago
- Component changed from General to Build/Test Tools
This ticket was discussed in the bug scrub and it was agreed to move this ticket to the Build/Test Tools
component, to pursue a test-only change now and see if a slurce change is needed in a future cycle.
This ticket was mentioned in Slack in #core by costdev. View the logs.
19 months ago
This ticket was mentioned in PR #4175 on WordPress/wordpress-develop by @SergeyBiryukov.
19 months ago
#20
- Keywords has-patch has-unit-tests added; needs-patch removed
Trac ticket: https://core.trac.wordpress.org/ticket/56817
#21
@
19 months ago
- Owner set to SergeyBiryukov
- Resolution set to fixed
- Status changed from new to closed
In 55462:
@SergeyBiryukov commented on PR #4175:
19 months ago
#22
Merged in r55462.
This is likely somehow being caused by https://github.com/php/php-src/issues/8805, which was included in PHP 8.2.0RC3. But still not sure how.