Opened 17 years ago
Closed 17 years ago
#4863 closed defect (bug) (fixed)
Bug in get_comment function from wp-includes/comment.php
Reported by: | BogdanGhervan | Owned by: | westi |
---|---|---|---|
Milestone: | 2.3 | Priority: | low |
Severity: | normal | Version: | |
Component: | General | Keywords: | get_comment comment.php |
Focuses: | Cc: |
Description
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.
Change History (2)
Note: See
TracTickets for help on using
tickets.
Hmm i suspect the intention here was for it to be $_comment->comment_ID that the cache was set on.
I think we need to check that the comment actually existed before we set the cache as well.