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/tests/phpunit/tests/general/template.php

    r43571 r44785  
    232232        $contents = file_get_contents( $filename );
    233233
    234         $upload              = wp_upload_bits( basename( $filename ), null, $contents );
     234        $upload              = wp_upload_bits( wp_basename( $filename ), null, $contents );
    235235        $this->site_icon_url = $upload['url'];
    236236
     
    410410        $filename = DIR_TESTDATA . '/images/test-image.jpg';
    411411        $contents = file_get_contents( $filename );
    412         $upload   = wp_upload_bits( basename( $filename ), null, $contents );
     412        $upload   = wp_upload_bits( wp_basename( $filename ), null, $contents );
    413413
    414414        // Save the data.
Note: See TracChangeset for help on using the changeset viewer.