### Eclipse Workspace Patch 1.0
#P wordpress-trunk
Index: wp-includes/functions.php
===================================================================
--- wp-includes/functions.php	(revision 17521)
+++ wp-includes/functions.php	(working copy)
@@ -1389,14 +1389,23 @@
  */
 function add_query_arg() {
 	$ret = '';
+
+	// reduce path in REQUEST_URI for auto-URIs.
+	// Ticket #16932
+	$request = $_SERVER['REQUEST_URI'];
+	( ( $query = (string) strstr($request, '?') ) || true)
+		&& '.php' === substr( $request, -strlen($query) - 4, -strlen($query) )
+		&& $request = basename( $request )
+		;
+
 	if ( is_array( func_get_arg(0) ) ) {
 		if ( @func_num_args() < 2 || false === @func_get_arg( 1 ) )
-			$uri = $_SERVER['REQUEST_URI'];
+			$uri = $request;
 		else
 			$uri = @func_get_arg( 1 );
 	} else {
 		if ( @func_num_args() < 3 || false === @func_get_arg( 2 ) )
-			$uri = $_SERVER['REQUEST_URI'];
+			$uri = $request;
 		else
 			$uri = @func_get_arg( 2 );
 	}
