Make WordPress Core

Opened 8 weeks ago

Last modified 8 weeks ago

#51839 new defect (bug)

When get_feed_permastruct() return false, get_feed_link() return incorrect non feed url

Reported by: hauvong Owned by:
Milestone: 5.7 Priority: normal
Severity: minor Version: 5.5
Component: Feeds Keywords: has-patch needs-unit-tests
Focuses: Cc:


When $this->permalink_structure is empty & $this->feed_structure is not set, the function get_feed_permastruct() would return boolean false causing get_feed_link() return incorrect non-feed url.

ref: https://github.com/WordPress/wordpress-develop/blob/4f28c68eb61c656ba6ee3305ee066ff76d7e7403/src/wp-includes/link-template.php#L628

Patch file to fix is attached.

Attachments (2)

class-wp-rewrite.php.patch (556 bytes) - added by hauvong 8 weeks ago.
51839.diff (534 bytes) - added by peterwilsoncc 8 weeks ago.

Download all attachments as: .zip

Change History (4)

#1 @peterwilsoncc
8 weeks ago

  • Keywords needs-unit-tests added
  • Milestone changed from Awaiting Review to 5.7

Thanks for the report, I've verified the issue. It was introduced in [47808] during the 5.5 release.

I'll move this to the 5.7 milestone. It would be good to include some tests for get_feed_link() when the permalink structure is undefined so I've added the needs-unit-tests keyword too.

8 weeks ago

#2 @peterwilsoncc
8 weeks ago

In 51839.diff I've moved the change to get_feed_link() rather than changing the return value and type of $wp_rewrite->get_feed_permastruct().

This is to avoid backward compatibility breaking for theme or plugin developers using the condition if ( $wp_rewrite->get_feed_permastruct() === false ) {}.

Note: See TracTickets for help on using tickets.