Index: src/wp-includes/functions.php
===================================================================
--- src/wp-includes/functions.php	(revision 26006)
+++ src/wp-includes/functions.php	(working copy)
@@ -3254,7 +3254,7 @@
 				$path = preg_replace( '#/' . preg_quote( $directory, '#' ) . '/[^/]*$#i', '' , $_SERVER['REQUEST_URI'] );
 			} elseif ( false !== strpos( $abspath_fix, $script_filename_dir ) ) {
 				// Request is hitting a file above ABSPATH
-				$subdirectory = str_replace( $script_filename_dir, '', $abspath_fix );
+				$subdirectory = substr( $abspath_fix, strpos( $abspath_fix, $script_filename_dir ) + strlen( $script_filename_dir ) );
 				// Strip off any file/query params from the path, appending the sub directory to the install
 				$path = preg_replace( '#/[^/]*$#i', '' , $_SERVER['REQUEST_URI'] ) . $subdirectory;
 			} else {
