[wp-trac] [WordPress Trac] #10377: Comment fields should have max lengths

WordPress Trac noreply at wordpress.org
Sat Jan 2 01:47:05 UTC 2016


#10377: Comment fields should have max lengths
---------------------------------------------------+-----------------------
 Reporter:  muriloazevedo                          |       Owner:
     Type:  defect (bug)                           |      Status:  assigned
 Priority:  normal                                 |   Milestone:  4.5
Component:  Comments                               |     Version:  2.8
 Severity:  normal                                 |  Resolution:
 Keywords:  has-patch has-unit-tests dev-feedback  |     Focuses:
---------------------------------------------------+-----------------------
Changes (by rachelbaker):

 * keywords:  has-patch needs-refresh => has-patch has-unit-tests dev-
               feedback


Comment:

 In [attachment:10377.4.diff]:

 - hardcoded `maxlength` attribute on the `comment_field`, the markup here
 can be modified via the `comment_form_defaults` filter (1)
 - added `wp_get_comment_column_max_length()` which returns the max column
 length for a given column name, and is filterable (2)
 - added logic in `wp_handle_comment_submission()` to return a WP_Error
 when the `comment_author`, `comment_author_url`, or `comment_content`
 values exceed the max length of their columns
 - added unit tests for the error conditions in
 `wp_handle_comment_submission()`

 1. We could add hardcoded attributes like this to the two other comment
 form inputs.  Open to second opinions here.
 2. Is there a good way to convert characters to bytes?

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


More information about the wp-trac mailing list