[wp-trac] [WordPress Trac] #59277: Bug: wp_check_filetype_and_ext returns type and ext as false for font files

WordPress Trac noreply at wordpress.org
Mon Sep 4 11:29:15 UTC 2023


#59277: Bug: wp_check_filetype_and_ext returns type and ext as false for font files
--------------------------+-----------------------------
 Reporter:  madhudollu    |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 the function `wp_check_filetype_and_ext` returns both `type` and `ext` as
 false for font files (.ttf, .woff, .woff2 etc..)

 This is because the `$real_mime` for the font files is `application/octet-
 stream` and the following condition has no check for font mimes.
 (`font/ttf`, `font/woff`)



 {{{
 // file: src/wp-includes/functions.php
 // line: 3184

 if ( in_array( $real_mime, $nonspecific_types, true ) ) {
   if ( ! in_array( substr( $type, 0, strcspn( $type, '/' ) ), array(
 'application', 'video', 'audio' ), true ) ) {
     $type = false;
     $ext  = false;
   }
 }
 }}}

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


More information about the wp-trac mailing list