[wp-trac] [WordPress Trac] #30412: get_approved_comments() behaviour change with post_id=0
WordPress Trac
noreply at wordpress.org
Thu Nov 20 01:28:28 UTC 2014
#30412: get_approved_comments() behaviour change with post_id=0
--------------------------+--------------------
Reporter: dd32 | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 4.1
Component: Comments | Version: trunk
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
--------------------------+--------------------
Comment (by boonebgorges):
Thanks for the patch, dd32, and sorry for breaking stuff :) I wanted to
verify that returning all comments when passing post_id=0 to
`WP_Comment_Query::query()` was the expected behavior in 4.0 and not a
regression (it was, and it's not). So the special case in
`get_approved_comments()` looks like the right fix to me.
[attachment:30412.patch] contains unit tests for passing 0 to
`get_approved_comments()` as well as `WP_Comment_Query`.
I'm posting this here rather than committing it straight away because I
wanted to ask you about making `$post_id` required. In a quick search on
Github, I couldn't find any instances of `get_approved_comments()` being
called without a parameter, but it could be happening somewhere, so I
don't see a reason why we should throw a notice in that case. At least,
it's not necessary to fix the bug reported in this ticket.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/30412#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list