When I allow anonymous users to view comments I receive following error:
PDOException: SQLSTATE[HY000]: General error: 1 near "0": syntax error: SELECT thread.thread AS thread_thread FROM (SELECT comment.thread AS thread FROM {comment} comment WHERE (nid = :db_condition_placeholder_0) AND (status = :db_condition_placeholder_1) ORDER BY created DESC, cid DESC LIMIT OFFSET 0) thread ORDER BY SUBSTRING(thread, 1, (LENGTH(thread) - 1)) ASC LIMIT 1 OFFSET 0; Array ( [:db_condition_placeholder_0] => 82 [:db_condition_placeholder_1] => 1 ) in comment_new_page_count() (line 547 of /var/www/d7.dyzio/htdocs/modules/comment/comment.module).
The website encountered an unexpected error. Please try again later.
I'm using D7-alpha5 on sqlite, comments and article nodes generated with Devel module (default settings).
When I disable threaded comments, the problem not occur.
Comments
Comment #1
mariusz.slonina commentedMaybecomment.thread AS thread FROM {comment}instead ofcomment.thread AS thread FROM {comment} comment?Comment #2
damien tournoud commentedThe problem is in the subquery:
That should be
LIMIT $new_replies OFFSET 0.But that's really weird, because comment_new_page_count() should never be called with an empty
$new_replies.Comment #3
mariusz.slonina commentedWhen I do dummy rewrite, the problem is gone, I'm sure it can be done much better
Comment #4
damien tournoud commented@mariusz.slonina: there are only two places in core where we call comment_new_page_count(), and both of them have a check on $new_replies before calling the function.
Can you check from where this function is called from your installation?
Comment #5
mariusz.slonina commentedComment_node_view on teaser, but that strange, beacuse comment_num_new should return FALSE on anonymous and function shouldn't be called
Comment #6
mariusz.slonina commentedI have Forum module disabled
Comment #7
mariusz.slonina commentedtry this (in comment_node_view):
Comment #8
mariusz.slonina commentedAttaching a patch
Comment #9
mariusz.slonina commentedSeems to be included in d7-beta1, thanks :)