Make WordPress Core

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#35356 closed defect (bug) (fixed)

wp_list_comments ignores $comments parameter

Reported by: felser's profile felser Owned by: boonebgorges's profile boonebgorges
Milestone: 4.4.2 Priority: high
Severity: normal Version: 4.6
Component: Comments Keywords: fixed-major
Focuses: Cc:

Description

Introduced in [36157].

This update does not check if a custom $comments array was provided before determining that a new comment query needs to be made.

If a comment array is provided, wp_list_comments shouldn't make a new query and should always use the provided comments.

Attachments (2)

comment-template.patch (4.0 KB) - added by ivankristianto 9 years ago.
This patch should fix this issue.
35356.diff (6.2 KB) - added by boonebgorges 9 years ago.

Download all attachments as: .zip

Change History (9)

#1 @boonebgorges
9 years ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 4.4.2
  • Owner set to boonebgorges
  • Priority changed from normal to high
  • Status changed from new to assigned

@felser Thanks for the ticket. You're correct that this is due to [36157] - it was an oversight on my part. It should just be a matter of moving the added logic inside the else block right below it, but this will need unit tests.

@ivankristianto
9 years ago

This patch should fix this issue.

#2 follow-up: @boonebgorges
9 years ago

  • Keywords has-patch needs-testing added; needs-patch removed

Thanks for the patch, @ivankristianto. It's frustrating that the separate_comments() logic has to be reproduced, but like you, I can't see a better way of doing it without rewriting the whole function.

35356.diff cleans up the formatting of the patch, and adds a unit test that demonstrates the issue. @felser or someone else having the problem, can you verify that the patch fixes the issue for you?

@boonebgorges
9 years ago

#3 in reply to: ↑ 2 @ivankristianto
9 years ago

Replying to boonebgorges:

It's frustrating that the separate_comments() logic has to be reproduced

Totally agree with you. It does repeated 3 times.

Last edited 9 years ago by ivankristianto (previous) (diff)

#4 @boonebgorges
9 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 36276:

Always respect $comments array passed to wp_list_comments().

[36157] fixed a bug whereby wp_list_comments() would not properly recognize
custom pagination arguments. See #35175. However, it inadvertently introduced
a bug that caused any $comments array explicitly passed to the function to be
ignored, when that array was accompanied by pagination arguments that differ
from those in $wp_query. We address this bug by moving the logic introduced
in [36157] inside a block that only fires when no $comments array has been
provided to the function.

Props ivankristianto.
Fixes #35356.

#5 @boonebgorges
9 years ago

  • Keywords fixed-major added; has-patch needs-testing removed
  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopening for 4.4.2.

#6 @dd32
9 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 36356:

Comments: Always respect $comments array passed to wp_list_comments().

[36157] fixed a bug whereby wp_list_comments() would not properly recognize
custom pagination arguments. See #35175. However, it inadvertently introduced
a bug that caused any $comments array explicitly passed to the function to be
ignored, when that array was accompanied by pagination arguments that differ
from those in $wp_query. We address this bug by moving the logic introduced
in [36157] inside a block that only fires when no $comments array has been
provided to the function.

Merges [36276] to the 4.4 branch.
Props ivankristianto, boonebgorges.
Fixes #35356.

#7 @boonebgorges
9 years ago

#35572 was marked as a duplicate.

Note: See TracTickets for help on using tickets.