Fix edge case in get_home_path() where the incorrect path may be returned. Props ptahdunbar. Fixes #18768

git-svn-id: https://develop.svn.wordpress.org/trunk@19697 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dion Hulse 2012-01-06 13:46:22 +00:00
parent 0bef3ee02a
commit 4afc9e59e2
1 changed files with 1 additions and 1 deletions

View File

@ -81,7 +81,7 @@ function get_home_path() {
$siteurl = get_option( 'siteurl' ); $siteurl = get_option( 'siteurl' );
if ( $home != '' && $home != $siteurl ) { if ( $home != '' && $home != $siteurl ) {
$wp_path_rel_to_home = str_replace($home, '', $siteurl); /* $siteurl - $home */ $wp_path_rel_to_home = str_replace($home, '', $siteurl); /* $siteurl - $home */
$pos = strpos($_SERVER["SCRIPT_FILENAME"], $wp_path_rel_to_home); $pos = strrpos($_SERVER["SCRIPT_FILENAME"], $wp_path_rel_to_home);
$home_path = substr($_SERVER["SCRIPT_FILENAME"], 0, $pos); $home_path = substr($_SERVER["SCRIPT_FILENAME"], 0, $pos);
$home_path = trailingslashit( $home_path ); $home_path = trailingslashit( $home_path );
} else { } else {