[wp-trac] [WordPress Trac] #37696: WP_Comment_Query looses sql_clauses with Object Cache

WordPress Trac noreply at wordpress.org
Wed Aug 17 17:33:04 UTC 2016


#37696: WP_Comment_Query looses sql_clauses with Object Cache
--------------------------+---------------------------
 Reporter:  Rarst         |       Owner:  boonebgorges
     Type:  defect (bug)  |      Status:  reviewing
 Priority:  normal        |   Milestone:  4.6.1
Component:  Comments      |     Version:  4.6
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+---------------------------
Description changed by SergeyBiryukov:

Old description:

> Once I updated my live site to WP 4.6 my error log started filling up
> with following:
>
> > WordPress database error You have an error in your SQL syntax; check
> the manual that corresponds to your MySQL server version for the right
> syntax to use near 'WHERE AND comment_parent IN
> (266250,266252,266255,266258,266259,266262,266264,2' at line 1 for query
> SELECT wp_comments.comment_ID, wp_comments.comment_parent WHERE AND
> comment_parent IN
> (266250,266252,266255,266258,266259,266262,266264,266267,266269) ORDER BY
> comment_date_gmt ASC, comment_ID ASC made by require('wp-blog-
> header.php'), require_once('wp-includes/template-loader.php'),
> include('/themes/twentysixteen/single.php'), comments_template,
> WP_Comment_Query->__construct, WP_Comment_Query->query,
> WP_Comment_Query->get_comments, WP_Comment_Query->fill_descendants,
> QM_DB->query
>
> Note the highly invalid query, missing parts like `FROM` altogether.
>
> The immediate cause seems to be `sql_clauses` property is not
> meaningfully filled at that point.
>
> Issue goes away if I disable Object Cache (Siteground's Memcached). If I
> flush cache I see clauses filling up correctly first time, then going
> blank again on reload.
>
> I would guess this is related to caching changes that shipped, but I
> cannot reproduce locally with different OC (APCu) or figure out at which
> point it goes wrong.

New description:

 Once I updated my live site to WP 4.6 my error log started filling up with
 following:
 `> WordPress database error You have an error in your SQL syntax; check
 the manual that corresponds to your MySQL server version for the right
 syntax to use near 'WHERE AND comment_parent IN
 (266250,266252,266255,266258,266259,266262,266264,2' at line 1 for query
 SELECT wp_comments.comment_ID, wp_comments.comment_parent WHERE AND
 comment_parent IN
 (266250,266252,266255,266258,266259,266262,266264,266267,266269) ORDER BY
 comment_date_gmt ASC, comment_ID ASC made by require('wp-blog-
 header.php'), require_once('wp-includes/template-loader.php'),
 include('/themes/twentysixteen/single.php'), comments_template,
 WP_Comment_Query->__construct, WP_Comment_Query->query,
 WP_Comment_Query->get_comments, WP_Comment_Query->fill_descendants,
 QM_DB->query`

 Note the highly invalid query, missing parts like `FROM` altogether.

 The immediate cause seems to be `sql_clauses` property is not meaningfully
 filled at that point.

 Issue goes away if I disable Object Cache (Siteground's Memcached). If I
 flush cache I see clauses filling up correctly first time, then going
 blank again on reload.

 I would guess this is related to caching changes that shipped, but I
 cannot reproduce locally with different OC (APCu) or figure out at which
 point it goes wrong.

--

--
Ticket URL: <https://core.trac.wordpress.org/ticket/37696#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list