Opened 9 years ago
Last modified 8 years ago
#36058 reviewing defect (bug)
PHP notices and invalid "View Post" link on edit-comments.php when post type does not exist
Reported by: | boonebgorges | Owned by: | |
---|---|---|---|
Milestone: | Future Release | Priority: | normal |
Severity: | normal | Version: | |
Component: | Comments | Keywords: | |
Focuses: | administration | Cc: |
Description
Steps to reproduce:
- Register a custom post type
- Create a post
- Create a comment on that post
- Stop registering the post type
- Visit wp-admin/edit-comments.php
The markup built in WP_Comments_List_Table::column_response()
for the "In Response To" column requires a valid post permalink, as well as the post type label corresponding to "View Post". Since permalinks to non-existent CPT objects cannot be valid, and since non-existent CPTs don't have any post type labels, it seems to me that we can probably bail out of this method early if the post type doesn't exist.
Similarly, column_date()
probably shouldn't attempt to link to the post if the post type doesn't exist.
Attachments (2)
Change History (10)
#3
in reply to:
↑ 2
@
9 years ago
Replying to SergeyBiryukov:
Yeah - #34918 and #16956 are about cap checks specifically, which, in addition to PHP notices and the like, can lead to privilege escalation in certain cases.
The current ticket is about whether various bits of the comment UX should be linked to the post permalink, when the post permalink can necessarily never be visited.
If we decide, as per #34918, that comments from non-existent post types should never be shown anywhere, then it will solve the current problem :) But if we decide to keep the rows, then we should fix/remove the links.
This ticket was mentioned in Slack in #core by sergey. View the logs.
9 years ago
#5
@
8 years ago
Related: #35279 - where the comment_date doesn't link to the post if the comment_post_ID = 0
, should also check that the post exists.
#6
@
8 years ago
- Milestone changed from Awaiting Review to 4.6
- Owner set to rachelbaker
- Status changed from new to reviewing
36058.diff is a suggested fix. It changes both the In Response To and Submitted On columns to plain, unlinked text when the post type doesn't exist.