Make WordPress Core


Ignore:
Timestamp:
01/29/2022 02:23:59 PM (3 years ago)
Author:
SergeyBiryukov
Message:

Users: Return a WP_Error from wp_insert_user() if the user_url field is too long.

The user_url database field only allows up to 100 characters, and if the value is longer than that, the function should return a proper error message instead of silently failing.

This complements similar checks for user_login and user_nicename fields.

Follow-up to [45], [1575], [32299], [34218], [34626].

Props mkox, sabernhardt, tszming, SergeyBiryukov.
Fixes #44107.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/user.php

    r52607 r52650  
    20442044    $user_url = apply_filters( 'pre_user_url', $raw_user_url );
    20452045
     2046    if ( mb_strlen( $user_url ) > 100 ) {
     2047        return new WP_Error( 'user_url_too_long', __( 'User URL may not be longer than 100 characters.' ) );
     2048    }
     2049
    20462050    $user_registered = empty( $userdata['user_registered'] ) ? gmdate( 'Y-m-d H:i:s' ) : $userdata['user_registered'];
    20472051
Note: See TracChangeset for help on using the changeset viewer.