[wp-trac] [WordPress Trac] #39732: Allowing wp_update_comment() to return WP_Error

WordPress Trac noreply at wordpress.org
Mon Jun 26 12:38:28 UTC 2017


#39732: Allowing wp_update_comment() to return WP_Error
-------------------------------------------------+-------------------------
 Reporter:  enrico.sorcinelli                    |       Owner:
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  4.9
Component:  Comments                             |     Version:  4.8
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-unit-tests needs-      |     Focuses:
  testing early                                  |
-------------------------------------------------+-------------------------

Comment (by enrico.sorcinelli):

 I just removed space.

 The new code above lives in `edit_comment()` function that is used only
 twice in the core for editing comments,
 ([[https://core.trac.wordpress.org/browser/trunk/src/wp-
 admin/comment.php?marks=311#L311|edit screen]] and
 [[https://core.trac.wordpress.org/browser/trunk/src/wp-admin/includes
 /ajax-actions.php?marks=1169#L1169|quick edit]]).
 Both codes already have inside other `wp_die` statements
 [[https://core.trac.wordpress.org/browser/trunk/src/wp-
 admin/includes/comment.php?marks=48-49#L48|here]].

 The main modification is that the patch aims to solve the fact that
 `wp_update_comment` uses `0` as the return value for both an error and a
 success (and until now editing comments in admin did not care of comment
 update return path at all).
 All `wp_update_comment` calls in the core have been updated and tested
 with new unit tests included in the patch.

 The only thing we need to be sure is to check all `wp_update_comment`
 extra-core calls (like plugins) where comment update calls will return
 only `false` and not also `0` on failure.

 But it's not a real problem for me since `wp_update_comment` already can
 return `false` and related code should take care with this regardless the
 proposal enhancement.

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


More information about the wp-trac mailing list