[wp-trac] [WordPress Trac] #44107: wp_insert_user should return WP_Error if user_url's length is too long

WordPress Trac noreply at wordpress.org
Sat Jan 29 14:22:02 UTC 2022


#44107: wp_insert_user should return WP_Error if user_url's length is too long
-------------------------------------------------+-------------------------
 Reporter:  tszming                              |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  6.0
Component:  Users                                |     Version:  2.0
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-unit-tests dev-        |     Focuses:
  feedback                                       |  administration
-------------------------------------------------+-------------------------

Comment (by SergeyBiryukov):

 Thanks for the patch and the unit test!

 This looks good, I only have a few minor notes:
 * The `if ( mb_strlen( $raw_user_url ) > 100 ) { ... }` condition itself
 does not need a DocBlock, as it's not a function nor a hook. See the
 [https://developer.wordpress.org/coding-standards/inline-documentation-
 standards/php/#what-should-be-documented documentation standards] for more
 details on what entities need a DocBlock.
 * I think the check should run after the `pre_user_url` filter, to make
 sure the filtered value is still no longer than 100 characters. That would
 be consistent with the `mb_strlen( $user_login ) > 60` check, which runs
 after the `pre_user_login` filter, though not with the `mb_strlen(
 $user_nicename ) > 50` check, which runs ''before'' the
 `pre_user_nicename` filter for some reason. Let's address the latter in a
 new ticket. Some history: [34218].
 * The unit test should also verify that the error code is
 `user_url_too_long`.

 I can make these adjustments on commit.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/44107#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list