mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
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:
@@ -1062,7 +1062,7 @@ abstract class WP_UnitTestCase_Base extends PHPUnit_Framework_TestCase {
|
||||
}
|
||||
|
||||
$attachment = array(
|
||||
'post_title' => basename( $upload['file'] ),
|
||||
'post_title' => wp_basename( $upload['file'] ),
|
||||
'post_content' => '',
|
||||
'post_type' => 'attachment',
|
||||
'post_parent' => $parent_post_id,
|
||||
|
||||
@@ -46,7 +46,7 @@ class WP_UnitTest_Factory_For_Attachment extends WP_UnitTest_Factory_For_Post {
|
||||
*/
|
||||
function create_upload_object( $file, $parent = 0 ) {
|
||||
$contents = file_get_contents( $file );
|
||||
$upload = wp_upload_bits( basename( $file ), null, $contents );
|
||||
$upload = wp_upload_bits( wp_basename( $file ), null, $contents );
|
||||
|
||||
$type = '';
|
||||
if ( ! empty( $upload['type'] ) ) {
|
||||
@@ -59,7 +59,7 @@ class WP_UnitTest_Factory_For_Attachment extends WP_UnitTest_Factory_For_Post {
|
||||
}
|
||||
|
||||
$attachment = array(
|
||||
'post_title' => basename( $upload['file'] ),
|
||||
'post_title' => wp_basename( $upload['file'] ),
|
||||
'post_content' => '',
|
||||
'post_type' => 'attachment',
|
||||
'post_parent' => $parent,
|
||||
|
||||
Reference in New Issue
Block a user