Skip to content

Commit

Permalink
Font Library: PHP 8.1.12 check for woff/woff2 mime types (#59015)
Browse files Browse the repository at this point in the history
Fixes a bug where fonts could not be installed in PHP 8.1.0 through 8.1.11 due to incorrect MIME type assignment. 

While `WP_Font_Utils::get_allowed_font_mime_types()` conditionally sets the MIME type for woff and woff2, it incorrectly checks against PHP 8.1.0. The MIME type change did not occur until PHP 8.1.12.

References:

* PHP-src: finfo returns wrong mime type for woff/woff2 files
* PHP 8.1.12 changelog
* Tests: Adjust the expected mime type for WOFF fonts on PHP 8.1.12+.

Co-authored-by: costdev <costdev@git.wordpress.org>
Co-authored-by: hellofromtonya <hellofromtonya@git.wordpress.org>
Co-authored-by: huzaifaalmesbah <huzaifaalmesbah@git.wordpress.org>
Co-authored-by: kafleg <kafleg@git.wordpress.org>
  • Loading branch information
5 people authored Feb 14, 2024
1 parent ba496e6 commit 2822029
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/compat/wordpress-6.5/fonts/class-wp-font-utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,8 @@ public static function get_allowed_font_mime_types() {
return array(
'otf' => 'application/vnd.ms-opentype',
'ttf' => PHP_VERSION_ID >= 70400 ? 'font/sfnt' : $php_7_ttf_mime_type,
'woff' => PHP_VERSION_ID >= 80100 ? 'font/woff' : 'application/font-woff',
'woff2' => PHP_VERSION_ID >= 80100 ? 'font/woff2' : 'application/font-woff2',
'woff' => PHP_VERSION_ID >= 80112 ? 'font/woff' : 'application/font-woff',
'woff2' => PHP_VERSION_ID >= 80112 ? 'font/woff2' : 'application/font-woff2',
);
}
}
Expand Down

1 comment on commit 2822029

@github-actions
Copy link

@github-actions github-actions bot commented on 2822029 Feb 14, 2024

Choose a reason for hiding this comment

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

Flaky tests detected in 2822029.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7903980771
📝 Reported issues:

Please sign in to comment.