Make WordPress Core

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#35356 closed defect (bug) (fixed)

wp_list_comments ignores $comments parameter

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

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 11 years ago.
This patch should fix this issue.
35356.diff​ (6.2 KB ) - added by boonebgorges 11 years ago.

Download all attachments as: .zip

Change History (9)

#1 @boonebgorges
11 years ago

  • Keywords needs-patch added
  • Milestone Awaiting Review → 4.4.2
  • Owner set to boonebgorges
  • Priority normal → high
  • Status new → 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
11 years ago

This patch should fix this issue.

#2 follow-up: @boonebgorges
11 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
11 years ago

#3 in reply to: ↑ 2 @ivankristianto
11 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 11 years ago by ivankristianto (previous) (diff)

#4 @boonebgorges
11 years ago

  • Resolution → fixed
  • Status assigned → 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
11 years ago

  • Keywords fixed-major added; has-patch needs-testing removed
  • Resolution fixed
  • Status closed → reopened

Reopening for 4.4.2.

#6 @dd32
11 years ago

  • Resolution → fixed
  • Status reopened → 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
11 years ago

#35572 was marked as a duplicate.

Note: See TracTickets for help on using tickets.