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-includes/class-wp-customize-manager.php

    r44714 r44785  
    13611361
    13621362                    // Copy file to temp location so that original file won't get deleted from theme after sideloading.
    1363                     $temp_file_name = wp_tempnam( basename( $file_path ) );
     1363                    $temp_file_name = wp_tempnam( wp_basename( $file_path ) );
    13641364                    if ( $temp_file_name && copy( $file_path, $temp_file_name ) ) {
    13651365                        $file_array['tmp_name'] = $temp_file_name;
     
    16221622                continue;
    16231623            }
    1624             $file_name = basename( $attachment['file'] );
     1624            $file_name = wp_basename( $attachment['file'] );
    16251625
    16261626            // Skip file types that are not recognized.
     
    45954595        if ( $this->return_url ) {
    45964596            $return_url = $this->return_url;
    4597         } elseif ( $referer && ! in_array( basename( parse_url( $referer, PHP_URL_PATH ) ), $excluded_referer_basenames, true ) ) {
     4597        } elseif ( $referer && ! in_array( wp_basename( parse_url( $referer, PHP_URL_PATH ) ), $excluded_referer_basenames, true ) ) {
    45984598            $return_url = $referer;
    45994599        } elseif ( $this->preview_url ) {
Note: See TracChangeset for help on using the changeset viewer.