[wp-trac] [WordPress Trac] #52814: Avoid notices in `get_post_comments_feed_link()`
WordPress Trac
noreply at wordpress.org
Mon Mar 15 03:12:57 UTC 2021
#52814: Avoid notices in `get_post_comments_feed_link()`
--------------------------+-----------------------------
Reporter: dd32 | Owner: (none)
Type: defect (bug) | Status: new
Priority: low | Milestone: Awaiting Review
Component: Feeds | Version:
Severity: trivial | Keywords:
Focuses: |
--------------------------+-----------------------------
When an atom feed request is made to a non-existent page,
get_post_comments_feed_link() produces PHP Notices such as the following:
{{{
E_NOTICE: Trying to get property 'post_type' of non-object in wp-includes
/link-template.php:752
}}}
Example of a URLs which can trigger this is:
{{{
OPTIONS /2021/01/feed/atom/atom/
GET /404-page/feed/atom/
}}}
(Options bypasses the canonical redirect, and outputs a post-comments feed
for the page "2021/01/feed/atom")
While the code path that results in this function being called without a
valid post is unexpected and the resulting url generated in the atom feed
is invalid, it silences these notices, which is good for sites that
log/monitor these things (Such as WordPress.org)
--
Ticket URL: <https://core.trac.wordpress.org/ticket/52814>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list