WordPress.org

Make WordPress Core


Ignore:
Timestamp:
03/01/2019 08:57:26 PM (6 months ago)
Author:
jorbin
Message:

Replace usages of basename() with wp_basename() in order to support multibyte filenames

This is focused on the pieces of code that touch media files and the tests that support them. basename isn't multibyte compatible out of the box. See http://php.net/basename and https://bugs.php.net/bug.php?id=62119.

See #43170.
Props Viper007Bond.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/deprecated.php

    r43174 r44785  
    18791879        // We have a thumbnail desired, specified and existing
    18801880
    1881         $src_file = basename($src);
     1881        $src_file = wp_basename($src);
    18821882    } elseif ( wp_attachment_is_image( $post->ID ) ) {
    18831883        // We have an image without a thumbnail
     
    18891889
    18901890        $icon_dir = apply_filters( 'icon_dir', get_template_directory() . '/images' );
    1891         $src_file = $icon_dir . '/' . basename($src);
     1891        $src_file = $icon_dir . '/' . wp_basename($src);
    18921892    }
    18931893
     
    30593059function get_theme_data( $theme_file ) {
    30603060    _deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_theme()' );
    3061     $theme = new WP_Theme( basename( dirname( $theme_file ) ), dirname( dirname( $theme_file ) ) );
     3061    $theme = new WP_Theme( wp_basename( dirname( $theme_file ) ), dirname( dirname( $theme_file ) ) );
    30623062
    30633063    $theme_data = array(
Note: See TracChangeset for help on using the changeset viewer.