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.


git-svn-id: https://develop.svn.wordpress.org/trunk@44785 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Aaron Jorbin
2019-03-01 20:57:26 +00:00
parent 4c45ff7c43
commit e421f262dc
32 changed files with 101 additions and 101 deletions

View File

@@ -1878,7 +1878,7 @@ function get_attachment_icon_src( $id = 0, $fullsize = false ) {
if ( !$fullsize && $src = wp_get_attachment_thumb_url( $post->ID ) ) {
// We have a thumbnail desired, specified and existing
$src_file = basename($src);
$src_file = wp_basename($src);
} elseif ( wp_attachment_is_image( $post->ID ) ) {
// We have an image without a thumbnail
@@ -1888,7 +1888,7 @@ function get_attachment_icon_src( $id = 0, $fullsize = false ) {
// No thumb, no image. We'll look for a mime-related icon instead.
$icon_dir = apply_filters( 'icon_dir', get_template_directory() . '/images' );
$src_file = $icon_dir . '/' . basename($src);
$src_file = $icon_dir . '/' . wp_basename($src);
}
if ( !isset($src) || !$src )
@@ -3058,7 +3058,7 @@ function remove_custom_background() {
*/
function get_theme_data( $theme_file ) {
_deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_theme()' );
$theme = new WP_Theme( basename( dirname( $theme_file ) ), dirname( dirname( $theme_file ) ) );
$theme = new WP_Theme( wp_basename( dirname( $theme_file ) ), dirname( dirname( $theme_file ) ) );
$theme_data = array(
'Name' => $theme->get('Name'),