Index: src/wp-includes/class-wp.php
===================================================================
--- src/wp-includes/class-wp.php	(revision 32706)
+++ src/wp-includes/class-wp.php	(working copy)
@@ -159,6 +159,7 @@
 			list( $req_uri ) = explode( '?', $_SERVER['REQUEST_URI'] );
 			$self = $_SERVER['PHP_SELF'];
 			$home_path = trim( parse_url( home_url(), PHP_URL_PATH ), '/' );
+			$home_path_regex = sprintf( '|^%s|i', preg_quote( $home_path, '#' ) );
 
 			// Trim path info from the end and the leading home path from the
 			// front. For path info requests, this leaves us with the requesting
@@ -166,13 +167,13 @@
 			// requested permalink.
 			$req_uri = str_replace($pathinfo, '', $req_uri);
 			$req_uri = trim($req_uri, '/');
-			$req_uri = preg_replace("|^$home_path|i", '', $req_uri);
+			$req_uri = preg_replace( $home_path_regex, '', $req_uri );
 			$req_uri = trim($req_uri, '/');
 			$pathinfo = trim($pathinfo, '/');
-			$pathinfo = preg_replace("|^$home_path|i", '', $pathinfo);
+			$pathinfo = preg_replace( $home_path_regex, '', $pathinfo );
 			$pathinfo = trim($pathinfo, '/');
 			$self = trim($self, '/');
-			$self = preg_replace("|^$home_path|i", '', $self);
+			$self = preg_replace( $home_path_regex, '', $self );
 			$self = trim($self, '/');
 
 			// The requested permalink is in $pathinfo for path info requests and
Index: tests/phpunit/tests/rewrite.php
===================================================================
--- tests/phpunit/tests/rewrite.php	(revision 32706)
+++ tests/phpunit/tests/rewrite.php	(working copy)
@@ -6,6 +6,7 @@
  * @group rewrite
  */
 class Tests_Rewrite extends WP_UnitTestCase {
+	private $home_url;
 
 	function setUp() {
 		global $wp_rewrite;
@@ -18,6 +19,8 @@
 		create_initial_taxonomies();
 
 		$wp_rewrite->flush_rules();
+
+		$this->home_url = get_option( 'home' );
 	}
 
 	function tearDown() {
@@ -24,6 +27,7 @@
 		global $wp_rewrite;
 		$wp_rewrite->init();
 
+		update_option( 'home', $this->home_url );
 		parent::tearDown();
 	}
 
@@ -74,6 +78,39 @@
 		$this->assertEquals( 0, url_to_postid( '/example-page/ex/' ) );
 	}
 
+	/**
+	 * @ticket 30438
+	 */
+	function test_parse_request_home_path() {
+		$home_url = home_url( '/path/' );
+		update_option( 'home', $home_url );
+
+		$this->go_to( $home_url );
+		$this->assertEquals( array(), $GLOBALS['wp']->query_vars );
+
+		$this->go_to( $home_url . 'page' );
+		$this->assertEquals( array('page' => '', 'pagename' => 'page'), $GLOBALS['wp']->query_vars );
+	}
+
+	/**
+	 * @ticket 30438
+	 */
+	function test_parse_request_home_path_with_regex_character() {
+		$home_url = home_url( '/ma.ch/' );
+		$not_a_home_url = home_url( '/match/' );
+		update_option( 'home', $home_url );
+
+		$this->go_to( $home_url );
+		$this->assertEquals( array(), $GLOBALS['wp']->query_vars );
+
+		$this->go_to( $home_url . 'page' );
+		$this->assertEquals( array('page' => '', 'pagename' => 'page'), $GLOBALS['wp']->query_vars );
+
+		$this->go_to( $not_a_home_url . 'page' );
+		$this->assertNotEquals( array('page' => '', 'pagename' => 'page'), $GLOBALS['wp']->query_vars );
+		$this->assertEquals( array('page' => '', 'pagename' => 'match/page'), $GLOBALS['wp']->query_vars );
+	}
+
 	function test_url_to_postid_dupe_path() {
 		update_option( 'home', home_url('/example/') );
 
