[wp-trac] [WordPress Trac] #38971: REST API: rest_comment_author_required should not allow empty value

WordPress Trac noreply at wordpress.org
Fri Dec 2 05:19:13 UTC 2016


#38971: REST API: rest_comment_author_required should not allow empty value
-------------------------------------------------+-------------------------
 Reporter:  hnle                                 |       Owner:
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  4.7
Component:  REST API                             |     Version:  trunk
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-unit-tests commit      |     Focuses:  rest-api
  dev-feedback                                   |
-------------------------------------------------+-------------------------

Comment (by flixos90):

 Minor test change in [attachment:38971.diff]: The `tearDown()` method of
 the test class has been removed since it's not necessary as database
 transactions as well as filters are reset automatically.

 Replying to [comment:17 joehoyle]:
 > Is `validate_callback' => null, // skip built-in validation of 'email'.
 ` needed? The validation should actually be hooked via the
 `sanitize_callback` now the sanitize callback can return a WP_Error.
 Nothing should default to `validate_callback`, see
 https://github.com/WordPress/WordPress/blob/master/wp-includes/rest-
 api.php#L858.

 I have a hard time understanding this: The function
 `check_comment_author_email()` does validation only, why should it be
 handled via `sanitize_callback`? It's possible of course, but I don't
 think it logically makes sense. If we wanna use `sanitize_callback` for
 validation as well, what would be the point of `validate_callback`?

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


More information about the wp-trac mailing list