Index: wp-includes/functions.php
===================================================================
--- wp-includes/functions.php	(revision 11119)
+++ wp-includes/functions.php	(working copy)
@@ -1317,19 +1317,23 @@
  * @uses $wpdb Used to sanitize values
  * @since 0.71
  *
- * @param array $array Array to used to walk while sanitizing contents.
- * @return array Sanitized $array.
+ * @param  mixed $array Array or else to used to walk while sanitizing contents.
+ * @return mixed Sanitized $array.
  */
 function add_magic_quotes( $array ) {
 	global $wpdb;
-
-	foreach ( (array) $array as $k => $v ) {
-		if ( is_array( $v ) ) {
+	
+	if ( is_array($array) ) {
+		foreach ( $array as $k => $v ) {
 			$array[$k] = add_magic_quotes( $v );
-		} else {
-			$array[$k] = $wpdb->escape( $v );
 		}
-	}
+	} elseif ( is_object($array) ) {
+		$array = add_magic_quotes( get_object_vars( $array ) );				
+	} elseif ( is_string($array) ) {
+		$array = $wpdb->escape( $array ); 						
+	} 
+	// no need to handle other types (float, bool, callback, resource.)
+	
 	return $array;
 }
 
