Index: wp-includes/formatting.php
===================================================================
--- wp-includes/formatting.php	(revision 51438)
+++ wp-includes/formatting.php	(working copy)
@@ -2125,32 +2125,36 @@ function sanitize_user( $username, $stri
 }

 /**
  * Sanitizes a string key.
  *
  * Keys are used as internal identifiers. Lowercase alphanumeric characters,
  * dashes, and underscores are allowed.
  *
  * @since 3.0.0
  *
  * @param string $key String key
  * @return string Sanitized key
  */
 function sanitize_key( $key ) {
 	$raw_key = $key;
-	$key     = strtolower( $key );
-	$key     = preg_replace( '/[^a-z0-9_\-]/', '', $key );
+	if ( ! is_string( $key ) ) {
+		$key = '';
+	}
+
+	$key = strtolower( $key );
+	$key = preg_replace( '/[^a-z0-9_\-]/', '', $key );

 	/**
 	 * Filters a sanitized key string.
 	 *
 	 * @since 3.0.0
 	 *
 	 * @param string $key     Sanitized key.
 	 * @param string $raw_key The key prior to sanitization.
 	 */
 	return apply_filters( 'sanitize_key', $key, $raw_key );
 }

 /**
  * Sanitizes a string into a slug, which can be used in URLs or HTML attributes.
  *
