[wp-trac] [WordPress Trac] #41846: Avoid PHP notice in get_comment_reply_link() for null comment
WordPress Trac
noreply at wordpress.org
Sun Sep 10 10:37:10 UTC 2017
#41846: Avoid PHP notice in get_comment_reply_link() for null comment
--------------------------+-----------------------------
Reporter: birgire | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Comments | Version: 2.7
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
When I was working on tests for {{{get_comment_reply_link()}}} I got a PHP
notice:
{{{
Notice Trying to get property of non-object ...
}}}
with inputs like:
{{{
get_comment_reply_link( array( 'depth' => 1, 'max_depth' => 2 ) );
}}}
when there's no current global comment available and the input comment is
null.
That's because of this part:
{{{
$comment = get_comment( $comment );
if ( empty( $post ) ) {
$post = $comment->comment_post_ID;
}
}}}
where there's no validation for {{{$comment}}}.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/41846>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list