WordPress.org

Make WordPress Core

Ticket #33498: get_home_path.patch

File get_home_path.patch, 943 bytes (added by handsomejack201, 4 years ago)

Patch to fix issue

  • wp/wp-admin/includes/file.php

    diff -r 6652291b30b5 -r fee9a713d799 wp/wp-admin/includes/file.php
    a b  
    8181        $siteurl = set_url_scheme( get_option( 'siteurl' ), 'http' );
    8282        if ( ! empty( $home ) && 0 !== strcasecmp( $home, $siteurl ) ) {
    8383                $wp_path_rel_to_home = str_ireplace( $home, '', $siteurl ); /* $siteurl - $home */
    84                 $pos = strripos( str_replace( '\\', '/', $_SERVER['SCRIPT_FILENAME'] ), trailingslashit( $wp_path_rel_to_home ) );
    85                 $home_path = substr( $_SERVER['SCRIPT_FILENAME'], 0, $pos );
     84                $script_filename = stripslashes( $_SERVER['SCRIPT_FILENAME'] );
     85                $pos = strripos( str_replace( '\\', '/', $script_filename ), trailingslashit( $wp_path_rel_to_home ) );
     86                $home_path = substr( $script_filename, 0, $pos );
    8687                $home_path = trailingslashit( $home_path );
    8788        } else {
    8889                $home_path = ABSPATH;