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

WordPress Trac noreply at wordpress.org
Wed Aug 17 16:07:38 UTC 2016


#37696: WP_Comment_Query looses sql_clauses with Object Cache
--------------------------+-----------------------------
 Reporter:  Rarst         |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Comments      |    Version:  4.6
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 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>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list