[wp-trac] [WordPress Trac] #63263: check if exists before accessing object properties of $post->comment_count
WordPress Trac
noreply at wordpress.org
Wed Oct 22 23:06:41 UTC 2025
#63263: check if exists before accessing object properties of $post->comment_count
---------------------------------------------+--------------------------
Reporter: Presskopp | Owner: westonruter
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: 6.9
Component: General | Version: 2.8
Severity: normal | Resolution:
Keywords: needs-test-info has-screenshots | Focuses:
---------------------------------------------+--------------------------
Changes (by westonruter):
* version: => 2.8
Comment:
This code originates in r19094 to work around the fact that `get_post()`
used to pass the first arg by reference ([https://github.com/WordPress
/wordpress-develop/blob/4399cf76106db6b4d4852fae2e1ceada521b6b64/wp-
includes/post.php#L371 ref]):
{{{
function &get_post(&$post, $output = OBJECT, $filter = 'raw')
}}}
The use of `$post->comment_count` originates in r10377
([https://github.com/WordPress/wordpress-
develop/commit/19577d0a8db6e7ac1d90c9eb61419f9ccf67bb10 19577d0]).
--
Ticket URL: <https://core.trac.wordpress.org/ticket/63263#comment:24>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list