diff --git a/wp-admin/includes/file.php b/wp-admin/includes/file.php index 9ff24384c..b3673041c 100644 --- a/wp-admin/includes/file.php +++ b/wp-admin/includes/file.php @@ -79,10 +79,10 @@ function get_file_description( $file ) { function get_home_path() { $home = get_option( 'home' ); $siteurl = get_option( 'siteurl' ); - if ( $home != '' && $home != $siteurl ) { - $wp_path_rel_to_home = str_replace($home, '', $siteurl); /* $siteurl - $home */ - $pos = strrpos($_SERVER["SCRIPT_FILENAME"], $wp_path_rel_to_home); - $home_path = substr($_SERVER["SCRIPT_FILENAME"], 0, $pos); + if ( ! empty( $home ) && 0 !== strcasecmp( $home, $siteurl ) ) { + $wp_path_rel_to_home = str_ireplace( $home, '', $siteurl ); /* $siteurl - $home */ + $pos = strripos( str_replace( '\\', '/', $_SERVER['SCRIPT_FILENAME'] ), $wp_path_rel_to_home); + $home_path = substr( $_SERVER['SCRIPT_FILENAME'], 0, $pos ); $home_path = trailingslashit( $home_path ); } else { $home_path = ABSPATH;