From 45863965f19a518f78e0ddf3e49bf5fc2d0204c8 Mon Sep 17 00:00:00 2001 From: ryan Date: Wed, 18 Jan 2006 05:37:26 +0000 Subject: [PATCH] sanitize_user() fixes. git-svn-id: http://svn.automattic.com/wordpress/trunk@3454 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/functions-formatting.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/wp-includes/functions-formatting.php b/wp-includes/functions-formatting.php index 255b6ccc23..274d7e6db1 100644 --- a/wp-includes/functions-formatting.php +++ b/wp-includes/functions-formatting.php @@ -266,7 +266,12 @@ function remove_accents($string) { } function sanitize_user( $username ) { - return preg_replace('|a-z0-9 _.-|i', '', $username); + $raw_username = $username; + $username = strip_tags($username); + // Kill octets + $username = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '', $username); + $username = preg_replace('/&.+?;/', '', $username); // Kill entities + return apply_filters('sanitize_user', $username, $raw_username); } function sanitize_title($title, $fallback_title = '') {