[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 01:41:09 UTC 2016


#38700: REST API: Cannot send an empty or no-op comment update
--------------------------+-----------------------------
 Reporter:  jnylen0       |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  REST API      |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Sending a POST/PUT/PATCH request to `/wp/v2/comments/:id` fails if the
 update is empty, or if the comment data is the same as what's currently
 stored in the database.

 This is due to a [https://core.trac.wordpress.org/browser/trunk/src/wp-
 includes/comment.php?rev=39153&marks=2204,2222#L2191 quirk] of
 `wp_update_comment`: it returns the number of rows updated by
 `$wpdb->update`, which may be zero.  However, zero is
 [https://core.trac.wordpress.org/browser/trunk/src/wp-
 includes/comment.php?rev=39153&marks=2146,2151#L2128 also used] as the
 return value for an error condition.  The API should differentiate between
 these two states.

 For any other object type, sending a "null update" via the API is
 successful.

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


More information about the wp-trac mailing list