Skip to content

Commit

Permalink
Editor: Check PHP 8.1.12 for woff/woff2 mime types in WP_Font_Utils.
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/php-src#8805 PHP-src: finfo returns wrong mime type for woff/woff2 files].
* [https://www.php.net/ChangeLog-8.php#8.1.12 PHP 8.1.12 changelog].
* Tests: Adjust the expected mime type for WOFF fonts on PHP 8.1.12+ [55463].
* [WordPress/gutenberg#59015 Gutenberg PR 59015].

Follow-up to [57539].

Props costdev, kafleg, hellofromTonya.
Fixes 60536.

git-svn-id: https://develop.svn.wordpress.org/trunk@57632 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
hellofromtonya committed Feb 14, 2024
1 parent 8ec4d9d commit e2aeb78
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/wp-includes/fonts/class-wp-font-utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,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',
);
}
}

0 comments on commit e2aeb78

Please sign in to comment.