﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc
14809	comments_by_type doesn't always get reset	nmassey		"in wp-includes/comment-template.php , in function comments_template(), it is possible for $wp_query->comments to be set but for $wp_query->comments_by_type NOT to get reset when it should be reset to array().  We ran into a bug because:[[BR]]
- on a single page (actually inside of a widget), we were pulling comments from multiple posts[[BR]]
- for each post, we were requesting get_comments(array('type' => 'comment'))[[BR]]
- in wp-includes/comment-template.php , in function wp_list_comments(), code says:
{{{
		if ( 'all' != $r['type'] ) {
			if ( empty($wp_query->comments_by_type) )
				$wp_query->comments_by_type = &separate_comments($wp_query->comments);
			if ( empty($wp_query->comments_by_type[$r['type']]) )
				return;
			$_comments = $wp_query->comments_by_type[$r['type']];

}}}
unfortunately, since we were running that again and again, it would not recalculate $wp_query->comments_by_type each time.

I think that the function comments_template() in wp-includes/comment-template.php should have the following line added:
{{{
     $wp_query->comments_by_type = array();
}}}
right after the line where $wp_query->comments is set."	defect (bug)	new	normal	Future Release	Comments	3.0.1	minor		reporter-feedback	
