#27442 closed defect (bug) (duplicate)
WP_Comment_Query conflicts when meta query 'count' is used with with 'group by'
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Comments | Keywords: | has-patch |
Focuses: | Cc: |
Description
This problem relates to /wp-includes/comment.php
, both 3.8.x, trunk and later versions are affected.
Line no. 393 (Version 3.8.1) is $groupby = "{$wpdb->comments}.comment_ID";
is not taking into consideration whether count
parameter is being used or not; which results into following wrong query output:
- This is Regualar Meta Query
comment row 1, data comment row 2, data comment row 3, data
- When count = true is used in the query the class definition only changes
SELECT *
intoSELECT COUNT(*)
which results into this, since there's a group by clause with the comment id.1 1 1
Hence the result will always be either 1 or NULL.
To resolve this, the GROUP BY
clause should be added only when count is not passed in the argument.
Attachments (1)
Change History (4)
Note: See
TracTickets for help on using
tickets.
Attaching the patch 27442.patch