Make WordPress Core

Ticket #57635: 57635.patch

File 57635.patch, 1.0 KB (added by kalpeshh, 3 years ago)

Patch for empty nicename check fix

  • src/wp-includes/user.php

    From 26e30b84c6e90891bdee892558d780671dd594bd Mon Sep 17 00:00:00 2001
    From: Kalpesh <kalpesh@xecurify.com>
    Date: Thu, 9 Feb 2023 01:50:15 +0530
    Subject: [PATCH] Empty nicename check fix after sanitize_user to avoid
     creating user with empty nicename
    
    ---
     src/wp-includes/user.php | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/src/wp-includes/user.php b/src/wp-includes/user.php
    index 018c960c031b..892f33cea43f 100644
    a b function wp_insert_user( $userdata ) { 
    18551855         * If a nicename is provided, remove unsafe user characters before using it.
    18561856         * Otherwise build a nicename from the user_login.
    18571857         */
    1858         if ( ! empty( $userdata['user_nicename'] ) ) {
     1858        if ( ! empty( sanitize_user( $userdata['user_nicename'], true ) ) ) {
    18591859                $user_nicename = sanitize_user( $userdata['user_nicename'], true );
    18601860                if ( mb_strlen( $user_nicename ) > 50 ) {
    18611861                        return new WP_Error( 'user_nicename_too_long', __( 'Nicename may not be longer than 50 characters.' ) );