[wp-trac] [WordPress Trac] #4863: Bug in get_comment function from wp-includes/comment.php

WordPress Trac wp-trac at lists.automattic.com
Wed Aug 29 15:33:46 GMT 2007


#4863: Bug in get_comment function from wp-includes/comment.php
---------------------------+------------------------------------------------
 Reporter:  BogdanGhervan  |       Owner:  anonymous              
     Type:  defect         |      Status:  new                    
 Priority:  low            |   Milestone:  2.3                    
Component:  General        |     Version:                         
 Severity:  normal         |    Keywords:  get_comment comment.php
---------------------------+------------------------------------------------
 In the get_comment function, this block of code:

 {{{
 $comment = (int) $comment;
 if ( !isset($comment_cache[$comment]) ) {
         $_comment = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE
 comment_ID = '$comment' LIMIT 1");
         $comment_cache[$comment->comment_ID] = & $_comment;
 }
 }}}

 Should change to:

 {{{

 $comment = (int) $comment;
 if ( !isset($comment_cache[$comment]) ) {
         $_comment = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE
 comment_ID = '$comment' LIMIT 1");
         $comment_cache[$comment] = & $_comment;
 }
 }}}

 $comment is an int, not an object, therefore the comment_ID property
 doesn't exist.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/4863>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list