Index: wp-includes/wp-db.php
===================================================================
--- wp-includes/wp-db.php	(revision 13447)
+++ wp-includes/wp-db.php	(working copy)
@@ -775,18 +775,7 @@
 	 * @return string|array escaped
 	 */
 	function _escape( $data ) {
-		if ( is_array( $data ) ) {
-			foreach ( (array) $data as $k => $v ) {
-				if ( is_array($v) )
-					$data[$k] = $this->_escape( $v );
-				else
-					$data[$k] = $this->_real_escape( $v );
-			}
-		} else {
-			$data = $this->_real_escape( $data );
-		}
-
-		return $data;
+		return $this->escape( $data );
 	}
 
 	/**
@@ -799,18 +788,10 @@
 	 * @return string|array escaped as query safe string
 	 */
 	function escape( $data ) {
-		if ( is_array( $data ) ) {
-			foreach ( (array) $data as $k => $v ) {
-				if ( is_array( $v ) )
-					$data[$k] = $this->escape( $v );
-				else
-					$data[$k] = $this->_weak_escape( $v );
-			}
-		} else {
-			$data = $this->_weak_escape( $data );
-		}
-
-		return $data;
+		if ( is_array( $data ) )
+			return array_map( array(&$this, 'escape'), $data );
+		else
+			return $this->_real_escape( $data );
 	}
 
 	/**
Index: wp-includes/formatting.php
===================================================================
--- wp-includes/formatting.php	(revision 13447)
+++ wp-includes/formatting.php	(working copy)
@@ -1214,10 +1214,7 @@
  * @return string Returns a string escaped with slashes.
  */
 function addslashes_gpc($gpc) {
-	if ( get_magic_quotes_gpc() )
-		$gpc = stripslashes($gpc);
-
-	return esc_sql($gpc);
+	return get_magic_quotes_gpc() ? $gpc : add_magic_quotes($gpc);
 }
 
 /**
@@ -2176,8 +2173,7 @@
  * @return string The cleaned $sql
  */
 function esc_sql( $sql ) {
-	global $wpdb;
-	return $wpdb->escape( $sql );
+	return add_magic_quotes( $sql );
 }
 
 /**
