Commit b6203440af for wordpress.org
commit b6203440af416a66d1dea00ef03dcb8c7e169e3c
Author: SergeyBiryukov <sergeybiryukov@git.wordpress.org>
Date: Sun Oct 4 22:51:50 2026 +0000
Code Quality: Remove PHP version checks for unsupported versions from `WP_Font_Utils`.
`WP_Font_Utils::get_allowed_font_mime_types()` chose the MIME type for `.ttf` files based on whether PHP was at least 7.3 or 7.4, falling back to `application/font-sfnt` or `application/x-font-ttf` on older versions. Since the minimum supported version of PHP was raised to 7.4 in r61459, both checks always pass, so `font/sfnt` is now returned directly and the fallbacks are removed. There is no change in behavior on any supported PHP version.
The checks for PHP 8.1.12 for `.woff` and `.woff2` files are still needed and remain, so the note in the docblock that font MIME types vary by PHP version still applies.
This resolves two errors in the `greaterOrEqual.alwaysTrue` PHPStan baseline.
Developed in https://github.com/WordPress/wordpress-develop/pull/13813.
Follow-up to r57539, r61459.
Props Soean, mukesh27.
See #65817.
Built from https://develop.svn.wordpress.org/trunk@64090
git-svn-id: http://core.svn.wordpress.org/trunk@63249 1a063a9b-81f0-0310-95a4-ce76da25c4cd
diff --git a/wp-includes/fonts/class-wp-font-utils.php b/wp-includes/fonts/class-wp-font-utils.php
index 0ec36abc3f..ee175f66aa 100644
--- a/wp-includes/fonts/class-wp-font-utils.php
+++ b/wp-includes/fonts/class-wp-font-utils.php
@@ -247,11 +247,9 @@ class WP_Font_Utils {
* @return string[] A collection of mime types keyed by file extension.
*/
public static function get_allowed_font_mime_types() {
- $php_7_ttf_mime_type = PHP_VERSION_ID >= 70300 ? 'application/font-sfnt' : 'application/x-font-ttf';
-
return array(
'otf' => 'application/vnd.ms-opentype',
- 'ttf' => PHP_VERSION_ID >= 70400 ? 'font/sfnt' : $php_7_ttf_mime_type,
+ 'ttf' => 'font/sfnt',
'woff' => PHP_VERSION_ID >= 80112 ? 'font/woff' : 'application/font-woff',
'woff2' => PHP_VERSION_ID >= 80112 ? 'font/woff2' : 'application/font-woff2',
);
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 7dd0c8fd7e..a80a5f24a0 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '7.2-alpha-64089';
+$wp_version = '7.2-alpha-64090';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.