From 499f18d2c28cc3abf438be196bc94e16cd976c3f Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Tue, 30 Oct 2012 20:58:35 +0000 Subject: [PATCH] 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 git-svn-id: https://develop.svn.wordpress.org/trunk@22331 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/functions.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index d75716bd5e..120cba6582 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -1399,20 +1399,20 @@ function get_temp_dir() { return trailingslashit(WP_TEMP_DIR); if ( $temp ) - return trailingslashit($temp); + return trailingslashit( rtrim( $temp, '\\' ) ); $is_win = ( 'WIN' === strtoupper( substr( PHP_OS, 0, 3 ) ) ); if ( function_exists('sys_get_temp_dir') ) { $temp = sys_get_temp_dir(); if ( @is_dir( $temp ) && ( $is_win ? win_is_writable( $temp ) : @is_writable( $temp ) ) ) { - return trailingslashit( $temp ); + return trailingslashit( rtrim( $temp, '\\' ) ); } } $temp = ini_get('upload_tmp_dir'); if ( is_dir( $temp ) && ( $is_win ? win_is_writable( $temp ) : @is_writable( $temp ) ) ) - return trailingslashit($temp); + return trailingslashit( rtrim( $temp, '\\' ) ); $temp = WP_CONTENT_DIR . '/'; if ( is_dir( $temp ) && ( $is_win ? win_is_writable( $temp ) : @is_writable( $temp ) ) )