[wp-trac] [WordPress Trac] #33710: Displaying a comment whose comment_parent has been deleted results in PHP Notices
WordPress Trac
noreply at wordpress.org
Thu Sep 3 15:19:24 UTC 2015
#33710: Displaying a comment whose comment_parent has been deleted results in PHP
Notices
----------------------------+-----------------------------
Reporter: rachelbaker | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Comments | Version:
Severity: normal | Keywords: needs-patch
Focuses: administration |
----------------------------+-----------------------------
There are missing checks in the Comments (wp-admin/edit-comments.php) and
Edit Comment (wp-admin/comment.php?action=editcomment&c={comment_ID})
screens for comments that have a `comment_parent`value. If the comment
parent was deleted , or for some reason doesn't exist, `get_comment(
$comment->comment_parent )` won't return an object. In both screens we
do not check that we have a parent object before calling
`get_comment_link()` or `get_comment_author()`, both of which also assume
a comment object exists, which result in '''PHP Notice: Trying to get
property of non-object''' messages.
Assuming your PHP error reporting level includes Notices, you log or
display the errors, and you enjoy replicating bugs; here are the steps to
reproduce:
1. Create a test comment
2. Reply to the test comment
3. Delete the test comment created in step 1
4. View the Comments screen
5. Note the PHP Notices (example https://cloudup.com/cpH6cjQry-a)
6. Locate your parentless comment (the reply created in step 2) in the
list table and click the "Edit" link
7. View the Edit Comment screen
8. Note the PHP Notices (example: https://cloudup.com/ckUOLcdVCY5)
9. Throw laptop out window
--
Ticket URL: <https://core.trac.wordpress.org/ticket/33710>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list