Index: src/wp-includes/formatting.php
===================================================================
--- src/wp-includes/formatting.php	(revision 34741)
+++ src/wp-includes/formatting.php	(working copy)
@@ -1952,11 +1952,8 @@
 }
 
 /**
- * Navigates through an array and removes slashes from the values.
+ * Navigates through a scalar, array, or an object and removes slashes from the values.
  *
- * If an array is passed, the array_map() function causes a callback to pass the
- * value back to the function. The slashes from this value will removed.
- *
  * @since 2.0.0
  *
  * @param mixed $value The value to be stripped.
@@ -1963,46 +1960,51 @@
  * @return mixed Stripped value.
  */
 function stripslashes_deep( $value ) {
-	if ( is_array($value) ) {
-		$value = array_map('stripslashes_deep', $value);
-	} elseif ( is_object($value) ) {
-		$vars = get_object_vars( $value );
-		foreach ($vars as $key=>$data) {
-			$value->{$key} = stripslashes_deep( $data );
-		}
-	} elseif ( is_string( $value ) ) {
-		$value = stripslashes($value);
-	}
+	return map_deep( 'stripslashes_from_strings_only', $value );
+}
 
-	return $value;
+function stripslashes_from_strings_only( $value ) {
+	return is_string( $value ) ? stripslashes( $value ) : $value;
 }
 
 /**
- * Navigates through an array and encodes the values to be used in a URL.
+ * Navigates through a scalar, array, or an object and encodes the values to be used in a URL.
  *
  *
  * @since 2.2.0
  *
- * @param array|string $value The array or string to be encoded.
- * @return array|string $value The encoded array (or string from the callback).
+ * @param mixed $value The array or string to be encoded.
+ * @return mixed $value The encoded value.
  */
 function urlencode_deep( $value ) {
-	return is_array( $value ) ? array_map( 'urlencode_deep', $value ) : urlencode( $value );
+	return map_deep( 'urlencode', $value );
 }
 
 /**
- * Navigates through an array and raw encodes the values to be used in a URL.
+ * Navigates through a scalar, array, or an object and raw-encodes the values to be used in a URL.
  *
  * @since 3.4.0
  *
- * @param array|string $value The array or string to be encoded.
- * @return array|string $value The encoded array (or string from the callback).
+ * @param mixed $value The array or string to be encoded.
+ * @return mixed $value The encoded value.
  */
 function rawurlencode_deep( $value ) {
-	return is_array( $value ) ? array_map( 'rawurlencode_deep', $value ) : rawurlencode( $value );
+	return map_deep( 'rawurlencode', $value );
 }
 
 /**
+ * Navigates through a scalar, array, or an object and decodes URL-encoded values
+ *
+ * @since 4.4.0
+ *
+ * @param mixed $value The array or string to be decoded.
+ * @return mixed $value The decoded value.
+ */
+function urldecode_deep( $value ) {
+	return map_deep( 'urldecode', $value );
+}
+
+/**
  * Converts email addresses characters to HTML entities to block spam bots.
  *
  * @since 0.71
@@ -3768,6 +3770,26 @@
 }
 
 /**
+ * Maps a function to all non-iterable elements of an array or an object
+ *
+ * @since 4.4.0 
+ * 
+ * @param callback $f The function to map onto $value
+ * @param mixed $value
+ * @return $value with applied to all non-arrays and non-objects inside it
+ */
+function map_deep( $f, $value) {
+	if ( is_array( $value ) || is_object( $value ) ) {
+		foreach( $value as &$item ) {
+			$item = map_deep( $f, $item );
+		}
+		return $value;
+	} else {
+		return call_user_func( $f, $value );
+	}
+}
+
+/**
  * Parses a string into variables to be stored in an array.
  *
  * Uses {@link http://www.php.net/parse_str parse_str()} and stripslashes if
