[wp-trac] [WordPress Trac] #39735: Right check for wp_update_comment (WP_REST_Comments_Controller::update_item)

WordPress Trac noreply at wordpress.org
Sun Jan 29 19:07:47 UTC 2017


#39735: Right check for wp_update_comment
(WP_REST_Comments_Controller::update_item)
-------------------------------+-----------------------------
 Reporter:  enrico.sorcinelli  |      Owner:
     Type:  defect (bug)       |     Status:  new
 Priority:  normal             |  Milestone:  Awaiting Review
Component:  REST API           |    Version:  trunk
 Severity:  normal             |   Keywords:
  Focuses:  rest-api           |
-------------------------------+-----------------------------
 The `WP_REST_Comments_Controller::update_item` method assumes that the
 `wp_update_comment` function returns also `false` value in order to check
 if the update fails.
 This is never true since `wp_update_comment` currently only returns `1` or
 `0` (and, if #39732 will be accepted, it could return also a
 `WP_Error`object)

 The attached patch fixes the check, even if the downside is that if no DB
 rows are updated, the method above return a `WP_Error`.

 Maybe have we to work into `wp_update_comment` allowing it to return also
 `false` value?

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


More information about the wp-trac mailing list