WordPress.org

Make WordPress Core

Ticket #23073: 23073.7.diff

File 23073.7.diff, 1.4 KB (added by SergeyBiryukov, 5 years ago)
  • wp-admin/network.php

     
    312312        $hostname          = get_clean_basedomain();
    313313        $slashed_home      = trailingslashit( get_option( 'home' ) );
    314314        $base              = parse_url( $slashed_home, PHP_URL_PATH );
    315         $wp_dir_from_root  = preg_replace( '#^' . preg_quote( $_SERVER['DOCUMENT_ROOT'], '#' ) . '#', '', ABSPATH );
    316         $wp_siteurl_subdir = trailingslashit( '/' . preg_replace( '#^' . preg_quote( $base, '#' ) . '#', '', $wp_dir_from_root ) );
     315        $document_root_fix = str_replace( '\\', '/', realpath( $_SERVER['DOCUMENT_ROOT'] ) );
     316        $abspath_fix       = str_replace( '\\', '/', ABSPATH );
     317        $home_path         = 0 === strpos( $abspath_fix, $document_root_fix ) ? $document_root_fix . $base : get_home_path();
     318        $home_path         = str_replace( '\\', '/', $home_path );
     319        $wp_siteurl_subdir = preg_replace( '#^' . preg_quote( $home_path, '#' ) . '#', '', $abspath_fix );
    317320        $rewrite_base      = ! empty( $wp_siteurl_subdir ) ? ltrim( trailingslashit( $wp_siteurl_subdir ), '/' ) : '';
    318321
    319         $home_path         = get_home_path();
    320 
    321322        $location_of_wp_config = ABSPATH;
    322323        if ( ! file_exists( ABSPATH . 'wp-config.php' ) && file_exists( dirname( ABSPATH ) . '/wp-config.php' ) )
    323324                $location_of_wp_config = trailingslashit( dirname( ABSPATH ) );