WordPress.org

Make WordPress Core

Ticket #15955: 15955.2.patch

File 15955.2.patch, 1001 bytes (added by solarissmoke, 3 years ago)
  • wp-admin/includes/file.php

     
    356356        // A writable uploads dir will pass this test. Again, there's no point overriding this one. 
    357357        if ( ! ( ( $uploads = wp_upload_dir($time) ) && false === $uploads['error'] ) ) 
    358358                return call_user_func($upload_error_handler, $file, $uploads['error'] ); 
    359  
     359                 
     360        // On Windows platforms, PHP will mangle characters not in the CP1251 charset, see http://bugs.php.net/bug.php?id=47096 
     361        if( 'WIN' == substr(PHP_OS, 0, 3) ) 
     362                $file['name'] = iconv( get_option( 'blog_charset' ), 'Windows-1251//TRANSLIT', $file['name'] ); 
     363                 
    360364        $filename = wp_unique_filename( $uploads['path'], $file['name'], $unique_filename_callback ); 
    361  
     365         
    362366        // Move the file to the uploads dir 
    363367        $new_file = $uploads['path'] . "/$filename"; 
    364368        if ( false === @ move_uploaded_file( $file['tmp_name'], $new_file ) )