Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#35433 closed defect (bug) (fixed)

Walker_Comment::comment calls comment_text which forces the comment to be re-queried rather than use $comments variable cache

Reported by: pcfreak30's profile pcfreak30 Owned by: wonderboymusic's profile wonderboymusic
Milestone: 4.6 Priority: normal
Severity: normal Version: 3.7
Component: Comments Keywords: has-patch needs-testing
Focuses: Cc:

Description

On line 282, by passing get_comment_id() you are causing the comment to be re-fetched rather than pull from the $comments array. This causes the filter comments_array to be bypassed and possibly others. If This is changed to false, null, 0, etc it uses correct data.

Attachments (1)

35433.diff (644 bytes) - added by rachelbaker 7 years ago.
Passing the entire WP_Comment object to the comment_text function

Download all attachments as: .zip

Change History (7)

#1 @ocean90
7 years ago

  • Version changed from trunk to 3.7
Version 0, edited 7 years ago by ocean90 (next)

#2 @pcfreak30
7 years ago

Actually this is still present in the latest version. 3.7 did not fix this or I would not have opened the issue.

@rachelbaker
7 years ago

Passing the entire WP_Comment object to the comment_text function

#3 @rachelbaker
7 years ago

  • Keywords has-patch needs-testing added
  • Milestone changed from Awaiting Review to Future Release

In 35433.diff instead of passing the comment_id, requiring the WP_Comment object to be re-fetched, I am passing in the WP_Comment object, which should prevent the additional query. @pcfreak30 would you be able to test the patch here?

#4 @pcfreak30
7 years ago

@rachelbaker I am not in a position to test this any further. This was found on a clients site and I do not have access to reproduce to try and test.

#5 @rachelbaker
7 years ago

  • Milestone changed from Future Release to 4.6

#6 @wonderboymusic
7 years ago

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

In 37325:

Comments: pass $comment to comment_text() in Walker_Comment::comment() instead of using a function which can skip the cache.

Props rachelbaker.
Fixes #35433.

Note: See TracTickets for help on using tickets.