[wp-trac] [WordPress Trac] #60823: Font Library: `mb_strtolower()` throws fatal without the optional `mbstring` PHP extension installed.

WordPress Trac noreply at wordpress.org
Fri Mar 22 02:08:02 UTC 2024


#60823: Font Library: `mb_strtolower()` throws fatal without the optional
`mbstring` PHP extension installed.
------------------------------+--------------------
 Reporter:  peterwilsoncc     |      Owner:  (none)
     Type:  defect (bug)      |     Status:  new
 Priority:  normal            |  Milestone:  6.5
Component:  Editor            |    Version:
 Severity:  normal            |   Keywords:
  Focuses:  coding-standards  |
------------------------------+--------------------
 `WP_Font_Utils::get_font_face_slug()` method includes an unconditional
 call to the function `mb_strtolower()`.

 As the [https://make.wordpress.org/hosting/handbook/server-environment
 /#php-extensions mbstring PHP package is optional] this should be wrapped
 by a `function_exists()` check and fall back to `strtolower()` if the
 function is not available.

 1. Visit https://playground.wordpress.net/?wp=nightly
 2. Click Edit Site in the toolbar
 3. Proceed to open the Font Library Model via the styles editor
 4. Open the browser console
 5. Upload a font file (that playground doesn't upload doesn't matter)
 6. Observe the fatal error shown in the console:

 {{{
 PHP Fatal error:  Uncaught Error: Call to undefined function
 mb_strtolower() in /wordpress/wp-includes/fonts/class-wp-font-utils.php
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/60823>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list