Opened 9 years ago
Closed 9 years ago
#34954 closed defect (bug) (fixed)
Comments Created Without a `comment_post_ID` Are Not Editable
Reported by: | rachelbaker | Owned by: | rachelbaker |
---|---|---|---|
Milestone: | 4.5 | Priority: | normal |
Severity: | normal | Version: | 4.2 |
Component: | Comments | Keywords: | good-first-bug has-patch has-unit-tests |
Focuses: | administration | Cc: |
Description
If a comment is created via wp_insert_comment()
without the optional comment_post_ID
parameter, the value in the database is 0
. The comment will display in the Comments list table, but if you try to edit the comment your changes never save.
This is (at least in part) due to the following code from src/wp-includes/comment.php
:
// Make sure that the comment post ID is valid (if specified). if ( isset( $commentarr['comment_post_ID'] ) && ! get_post( $commentarr['comment_post_ID'] ) ) { return 0; }
The check here should be changed to ! empty()
since isset()
would be true for a 0
value.
Attachments (2)
Change History (9)
#4
@
9 years ago
- Keywords has-patch needs-unit-tests added; needs-patch removed
Patch looks good. Would be nice to have a unit test describing the bug so we don't do this again.
#5
@
9 years ago
- Keywords has-unit-tests added; needs-unit-tests removed
@boonebgorges Added unit tests in 34954.1.patch, can you review the tests for me?
Note: See
TracTickets for help on using
tickets.
Introduced in [31195].