[wp-trac] [WordPress Trac] #41846: Avoid PHP notice in get_comment_reply_link() for null comment

WordPress Trac noreply at wordpress.org
Fri Sep 27 18:41:46 UTC 2019


#41846: Avoid PHP notice in get_comment_reply_link() for null comment
---------------------------------------------+------------------------
 Reporter:  birgire                          |       Owner:  whyisjake
     Type:  defect (bug)                     |      Status:  closed
 Priority:  normal                           |   Milestone:  5.3
Component:  Comments                         |     Version:  2.7
 Severity:  normal                           |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests commit  |     Focuses:
---------------------------------------------+------------------------

Comment (by birgire):

 @johnbillion good question

 At the time I think I might have looked at the validation on some of the
 other input arguments, that also returns null when invalid, correpsonding
 to the existing void part of the docs:

 {{{
  * @return void|false|string Link to show comment form, if successful.
 False, if comments are closed.
 }}}

 I might have also looked into {{{get_post()}}} as a reference point too,
 for a typical WordPress practice, as it returns null on failure of finding
 a global post object:

 https://core.trac.wordpress.org/browser/tags/5.2/src/wp-
 includes/post.php#L726


 But I'm all in for helping devs to better debug their code.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/41846#comment:12>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list