mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 06:10:09 +00:00
Always sanitize user_nicename in wp_insert_user().
Previously, a 'user_nicename' parameter passed into the function was unsanitized. This could result in a mismatch between the sanitized nicename generated automatically at user creation, resulting in broken author archive permalinks. Props joemcgill. Fixes #29696. git-svn-id: https://develop.svn.wordpress.org/trunk@29819 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -654,4 +654,19 @@ class Tests_User extends WP_UnitTestCase {
|
||||
$metas = array_keys( get_user_meta( 1 ) );
|
||||
$this->assertNotContains( 'key', $metas );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 29696
|
||||
*/
|
||||
public function test_wp_insert_user_should_sanitize_user_nicename_parameter() {
|
||||
$user = $this->factory->user->create_and_get();
|
||||
|
||||
$userdata = $user->to_array();
|
||||
$userdata['user_nicename'] = str_replace( '-', '.', $user->user_nicename );
|
||||
wp_insert_user( $userdata );
|
||||
|
||||
$updated_user = new WP_User( $user->ID );
|
||||
|
||||
$this->assertSame( $user->user_nicename, $updated_user->user_nicename );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user