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

WordPress Trac noreply at wordpress.org
Mon Jun 29 23:59:09 UTC 2020


#39732: Allowing wp_update_comment() to return WP_Error
-------------------------------------------------+-------------------------
 Reporter:  enrico.sorcinelli                    |       Owner:
                                                 |  enrico.sorcinelli
     Type:  enhancement                          |      Status:  reopened
 Priority:  normal                               |   Milestone:  5.5
Component:  Comments                             |     Version:  4.8
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-unit-tests needs-dev-  |     Focuses:
  note commit                                    |
-------------------------------------------------+-------------------------
Changes (by SergeyBiryukov):

 * status:  closed => reopened
 * resolution:  fixed =>


Comment:

 I would also like to take this opportunity to reconsider the return values
 for an invalid comment or post ID, changing them from `0` to `false`, as
 previously suggested by @dd32 in comment:8:ticket:38700:
 > The two `return 0`'s were seemingly added due to the function doc
 specifying 1 = success, 0 = failure, which was only because it returned
 the number of rows affected.
 > I know it'd technically be a BC change, but given WordPress really
 doesn't encourage strict type checking for falsey values I think that'd be
 a viable option here.

 Also related: comment:3:ticket:39735.

 See [attachment:"39732.12.diff"].

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


More information about the wp-trac mailing list