WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/30/2012 08:58:35 PM (7 years ago)
Author:
dd32
Message:

Prevent an issue on windows systems which can cause the temporary directory from get_temp_dir() from returning a path containing \/. Props to SergeyBiryukov for the initial patch. Fixes #20778

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions.php

    r22314 r22331  
    14001400
    14011401    if ( $temp )
    1402         return trailingslashit($temp);
     1402        return trailingslashit( rtrim( $temp, '\\' ) );
    14031403
    14041404    $is_win = ( 'WIN' === strtoupper( substr( PHP_OS, 0, 3 ) ) );
     
    14071407        $temp = sys_get_temp_dir();
    14081408        if ( @is_dir( $temp ) && ( $is_win ? win_is_writable( $temp ) : @is_writable( $temp ) ) ) {
    1409             return trailingslashit( $temp );
     1409            return trailingslashit( rtrim( $temp, '\\' ) );
    14101410        }
    14111411    }
     
    14131413    $temp = ini_get('upload_tmp_dir');
    14141414    if ( is_dir( $temp ) && ( $is_win ? win_is_writable( $temp ) : @is_writable( $temp ) ) )
    1415         return trailingslashit($temp);
     1415        return trailingslashit( rtrim( $temp, '\\' ) );
    14161416
    14171417    $temp = WP_CONTENT_DIR . '/';
Note: See TracChangeset for help on using the changeset viewer.