Make WordPress Core

Changeset 57865

Timestamp:
03/22/2024 02:15:24 PM (8 months ago)
Author:
swissspidy
Message:

Editor: Check if mb_strtolower exists before using it in the font library.

Prevents an error when uploading fonts on certain systems, because the mbstring extension can be missing and thus the function may not be available.

Props mujuonly, swissspidy, peterwilsoncc.
Fixes #60823.
See #55603.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/fonts/class-wp-font-utils.php

    r57657 r57865  
    111111        );
    112112        $settings = wp_parse_args( $settings, $defaults );
    113 
    114         $font_family   = mb_strtolower( $settings['fontFamily'] );
     113        if ( function_exists( 'mb_strtolower' ) ) {
     114            $font_family = mb_strtolower( $settings['fontFamily'] );
     115        } else {
     116            $font_family = strtolower( $settings['fontFamily'] );
     117        }
    115118        $font_style    = strtolower( $settings['fontStyle'] );
    116119        $font_weight   = strtolower( $settings['fontWeight'] );
Note: See TracChangeset for help on using the changeset viewer.