Make WordPress Core


Ignore:
Timestamp:
03/01/2019 08:57:26 PM (6 years 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-admin/includes/class-wp-site-icon.php

    r42871 r44785  
    8686        $parent     = get_post( $parent_attachment_id );
    8787        $parent_url = wp_get_attachment_url( $parent->ID );
    88         $url        = str_replace( basename( $parent_url ), basename( $cropped ), $parent_url );
     88        $url        = str_replace( wp_basename( $parent_url ), wp_basename( $cropped ), $parent_url );
    8989
    9090        $size       = @getimagesize( $cropped );
     
    9393        $object = array(
    9494            'ID'             => $parent_attachment_id,
    95             'post_title'     => basename( $cropped ),
     95            'post_title'     => wp_basename( $cropped ),
    9696            'post_content'   => $url,
    9797            'post_mime_type' => $image_type,
Note: See TracChangeset for help on using the changeset viewer.