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. Built from https://develop.svn.wordpress.org/trunk@52650 git-svn-id: http://core.svn.wordpress.org/trunk@52239 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
c0cbf007f0
commit
b3aae615bb
wp-includes
|
@ -2043,6 +2043,10 @@ function wp_insert_user( $userdata ) {
|
|||
*/
|
||||
$user_url = apply_filters( 'pre_user_url', $raw_user_url );
|
||||
|
||||
if ( mb_strlen( $user_url ) > 100 ) {
|
||||
return new WP_Error( 'user_url_too_long', __( 'User URL may not be longer than 100 characters.' ) );
|
||||
}
|
||||
|
||||
$user_registered = empty( $userdata['user_registered'] ) ? gmdate( 'Y-m-d H:i:s' ) : $userdata['user_registered'];
|
||||
|
||||
$user_activation_key = empty( $userdata['user_activation_key'] ) ? '' : $userdata['user_activation_key'];
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.0-alpha-52649';
|
||||
$wp_version = '6.0-alpha-52650';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue