Opened 4 years ago
Closed 4 years ago
#51839 closed defect (bug) (fixed)
When get_feed_permastruct() return false, get_feed_link() return incorrect non feed url
Reported by: | hauvong | Owned by: | johnbillion |
---|---|---|---|
Milestone: | 5.7 | Priority: | normal |
Severity: | minor | Version: | 5.5 |
Component: | Feeds | Keywords: | has-patch has-unit-tests commit |
Focuses: | Cc: |
Description
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.
Patch file to fix is attached.
Attachments (3)
Change History (11)
#2
@
4 years 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 ) {}
.
This ticket was mentioned in Slack in #core by hellofromtonya. View the logs.
4 years ago
This ticket was mentioned in Slack in #core by peterwilsoncc. View the logs.
4 years ago
#5
@
4 years ago
- Keywords has-unit-tests added; needs-unit-tests removed
In 51839.2.diff :
- Same change to
get_feed_link()
as earlier, using a truthy check rather than strict check - Unit tests x3 sets
- plain permalinks
- pretty links without a plain text prefix
- pretty links with a plain text prefix
All looks to be passing but another set of eyes would be ideal.
#6
@
4 years ago
- Keywords commit added
Thanks @hauvong for catching the issue and @peterwilsoncc for the tests!
51839.2.diff looks good to me.
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 theneeds-unit-tests
keyword too.