Make WordPress Core

Opened 11 years ago

Closed 11 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 Owned by: rachelbaker
Priority: normal Milestone: 4.5
Component: Comments Version: 4.4
Severity: normal Keywords: has-patch
Cc: Focuses: administration

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 11 years ago.
The third comment (from Moe) has a comment_post_ID of 0
35506.diff​ (454 bytes ) - added by rachelbaker 11 years ago.
Use the GLOBALS array when using unset()

Download all attachments as: .zip

Change History (5)

@rachelbaker
11 years ago

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

#1 @rachelbaker
11 years ago

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

@rachelbaker
11 years ago

Use the GLOBALS array when using unset()

#2 @rachelbaker
11 years ago

  • Keywords has-patch added; needs-patch removed
  • Milestone Awaiting Review → 4.5
  • Version → 4.4

#3 @rachelbaker
11 years ago

  • Owner set to rachelbaker
  • Resolution → fixed
  • Status new → 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.