[wp-trac] [WordPress Trac] #35624: Use of get_comment() function shows Notice

WordPress Trac noreply at wordpress.org
Fri Jan 29 04:53:51 UTC 2016


#35624: Use of get_comment() function shows Notice
--------------------------+------------------------------
 Reporter:  WisdmLabs     |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Comments      |     Version:  4.4.1
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by boonebgorges):

 Replying to [comment:2 WisdmLabs]:
 > Hi @boonebgorges,
 >
 > Thanks for your reply. Here is how the `get_comment()` function is being
 called in my case -
 >
 > I am using `wp_list_comments()` which has a callback function. This
 callback function has global `$comment` set (which works fine) and the
 `comment_reply_link()` function to display the '''Reply''' link. Whenever
 this '''Reply''' link is clicked, it shows the following Notice -
 >
 > {{{
 > Trying to get property of non-object in <WP DIR>/wp-includes/comment-
 template.php on line 646
 > }}}
 >
 > When I debugged this, I found that it uses the `get_comment()` function
 which is causing the notice and that notice is being displayed after
 clicking on '''Reply''' link in the comment box. I have added the
 `comment-reply.js` which loads the comment reply box via JavaScript and
 PHP call is not made and hence that notice is not visible which is fine
 for me. But was just wondering if this is some issue in the core where
 some validation is not handled yet.

 Can you provide a full stack trace leading up to the error? You said (as I
 expected) that you're having no problems when the global `$comment` is
 set, but that you have problems after clicking a link; but I'm not sure
 where you're going or what's being fired after the link is clicked.

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


More information about the wp-trac mailing list