Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#35506 closed defect (bug) (fixed)

The global `$post` object for rows in the comments list table is polluted if `comment_post_ID` = 0

Reported by: rachelbaker's profile rachelbaker Owned by: rachelbaker's profile rachelbaker
Milestone: 4.5 Priority: normal
Severity: normal Version: 4.4
Component: Comments Keywords: has-patch
Focuses: administration Cc:

Description

In WP_Comments_List_Table->single_row() the global $post object is only set for each row if comment_post_ID > 0. In the column_response method the $post global is used to display the information about the related Post for each comment. If the comment_post_ID is 0 then this column displays the related Post information from the previous row that could return a valid Post object from the comment_post_ID.

Attachments (2)

moe-has-no-post.png (180.9 KB) - added by rachelbaker 9 years ago.
The third comment (from Moe) has a comment_post_ID of 0
35506.diff (454 bytes) - added by rachelbaker 9 years ago.
Use the GLOBALS array when using unset()

Download all attachments as: .zip

Change History (5)

@rachelbaker
9 years ago

The third comment (from Moe) has a comment_post_ID of 0

#1 @rachelbaker
9 years ago

Looks like this was caused by r35674 from #34654. Also related: #33638

@rachelbaker
9 years ago

Use the GLOBALS array when using unset()

#2 @rachelbaker
9 years ago

  • Keywords has-patch added; needs-patch removed
  • Milestone changed from Awaiting Review to 4.5
  • Version set to 4.4

#3 @rachelbaker
9 years ago

  • Owner set to rachelbaker
  • Resolution set to fixed
  • Status changed from new to closed

In 36339:

List Tables: Use the $GLOBALS array when unsetting the global post and comment in WP_Comments_List_Table::single_row().

In r35674 only the local variables were unset, when using unset() with a global variable the $GLOBALS array must be used.

Fixes #35506.

Note: See TracTickets for help on using tickets.