WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 3 years ago

#14908 closed defect (bug) (fixed)

Incorrect top-level threading in non-singular Atom comment feed

Reported by: mdgl Owned by: westi
Milestone: 3.3 Priority: normal
Severity: normal Version: 3.0.1
Component: Feeds Keywords: has-patch needs-testing
Focuses: Cc:

Description

In non-singular Atom comment feeds (i.e. those for archives, search and home), incorrect threading information is provided for top-level comments (i.e. comments that refer directly to a post/page, not ones made in reply to another comment).

Instead of the correct and specific parent post in each case, the threading information for such comments always refers to the same single (random) post from the feed.

To reproduce the bug, create several new top-level comments on distinct posts and then view the generated XML for the Atom comments feed on your blog home page, inspecting the "<thr:in-reply-to>" elements as defined by RFC 4685.

The erroneous code seems to be in file "feed-atom-comments.php" at line 76 (at WP 3.0.1), where the parent link is output using "the_guid()" and "the_permalink_rss()". I think these functions need to refer to the correct and specific parent post using the variable "$comment_post". See the related code outputting the "<title>" element earlier in this file.

Also in this file at line 46 is what appears to be a redundant call to "get_post_custom" where the output is simply thrown away [this is also in file "feed-rss-comments.php" line 66]. Perhaps this was part of some earlier attempt to get the appropriate global variables updated, but in any case it doesn't work and seems completely unnecessary!

I'm surprised this threading issue hasn't been noticed before. It looks like nobody uses this stuff :-)

Attachments (3)

14908.patch (463 bytes) - added by solarissmoke 3 years ago.
Ensure post global is set in feed-atom-comments.php
14908.diff (543 bytes) - added by solarissmoke 3 years ago.
Updated patch - no need to pass by reference in PHP5
14908.2.patch (1000 bytes) - added by SergeyBiryukov 3 years ago.

Download all attachments as: .zip

Change History (9)

solarissmoke3 years ago

Ensure post global is set in feed-atom-comments.php

comment:1 solarissmoke3 years ago

  • Keywords has-patch added

Wow, I'm surprised too! I guess most people stick with RSS.

comment:2 markjaquith3 years ago

  • Keywords 3.2-early added
  • Milestone changed from Awaiting Review to Future Release

Nice catch.

solarissmoke3 years ago

Updated patch - no need to pass by reference in PHP5

comment:3 solarissmoke3 years ago

This is a really simple fix for an issue that has been open for a year, would be nice to see it in 3.3?

comment:4 westi3 years ago

  • Keywords needs-testing added; 3.2-early removed
  • Milestone changed from Future Release to 3.3
  • Owner set to westi
  • Status changed from new to accepted

SergeyBiryukov3 years ago

comment:5 SergeyBiryukov3 years ago

14908.2.patch also removes redundant calls to get_post_custom().

comment:6 westi3 years ago

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

In [18716]:

Set up the post global variable in the comment feed loops so that any calls to post related template tags work correctly.
Ensures that atom feeds show threading for top-level comments correctly.
Fixes #14908 props solarissmoke and SergeyBiryukov.

Note: See TracTickets for help on using tickets.