[wp-trac] [WordPress Trac] #38700: REST API: Cannot send an empty or no-op comment update

WordPress Trac noreply at wordpress.org
Tue Nov 8 20:31:21 UTC 2016


#38700: REST API: Cannot send an empty or no-op comment update
--------------------------------------+-----------------------------
 Reporter:  jnylen0                   |       Owner:  rmccue
     Type:  defect (bug)              |      Status:  assigned
 Priority:  normal                    |   Milestone:  Future Release
Component:  REST API                  |     Version:  trunk
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:
--------------------------------------+-----------------------------
Changes (by jnylen0):

 * keywords:  has-patch has-unit-tests 4.8-early => has-patch has-unit-tests


Comment:

 @rmccue @dd32 I think we should fix this in 4.7.  An unexpected HTTP 500
 for no good reason is pretty bad.

 The two error conditions in `wp_update_comment` that we're trying to catch
 are (1) invalid comment ID and (2) invalid comment post ID.  We already
 check [https://core.trac.wordpress.org/browser/trunk/src/wp-includes/rest-
 api/endpoints/class-wp-rest-comments-
 controller.php?rev=39165&marks=613-615#L599 (1)] in the API, let's check
 (2) as well and return a better error code than the 500.

 After that, we can fix this issue by disregarding the return value of
 `wp_update_comment`.

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


More information about the wp-trac mailing list