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/tests/phpunit/includes/factory/class-wp-unittest-factory-for-attachment.php

    r44497 r44785  
    4747    function create_upload_object( $file, $parent = 0 ) {
    4848        $contents = file_get_contents( $file );
    49         $upload   = wp_upload_bits( basename( $file ), null, $contents );
     49        $upload   = wp_upload_bits( wp_basename( $file ), null, $contents );
    5050
    5151        $type = '';
     
    6060
    6161        $attachment = array(
    62             'post_title'     => basename( $upload['file'] ),
     62            'post_title'     => wp_basename( $upload['file'] ),
    6363            'post_content'   => '',
    6464            'post_type'      => 'attachment',
Note: See TracChangeset for help on using the changeset viewer.