From b4858c78eec5fa31c9b4e67e679dc09a96a62c0f Mon Sep 17 00:00:00 2001 From: Alex Pott <alex.a.pott@googlemail.com> Date: Mon, 23 Mar 2015 09:59:17 +0000 Subject: [PATCH] Issue #1598924 by david_garcia, omegamonk: Query with duplicate placeholders throws PDO Exception --- .../comment/src/Plugin/views/field/NodeNewComments.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/modules/comment/src/Plugin/views/field/NodeNewComments.php b/core/modules/comment/src/Plugin/views/field/NodeNewComments.php index 2328fece7761..695bd91b2c4d 100644 --- a/core/modules/comment/src/Plugin/views/field/NodeNewComments.php +++ b/core/modules/comment/src/Plugin/views/field/NodeNewComments.php @@ -133,11 +133,12 @@ public function preRender(&$values) { if ($nids) { $result = $this->database->query("SELECT n.nid, COUNT(c.cid) as num_comments FROM {node} n INNER JOIN {comment_field_data} c ON n.nid = c.entity_id AND c.entity_type = 'node' AND c.default_langcode = 1 LEFT JOIN {history} h ON h.nid = n.nid AND h.uid = :h_uid WHERE n.nid IN ( :nids[] ) - AND c.changed > GREATEST(COALESCE(h.timestamp, :timestamp), :timestamp) AND c.status = :status GROUP BY n.nid", array( + AND c.changed > GREATEST(COALESCE(h.timestamp, :timestamp1), :timestamp2) AND c.status = :status GROUP BY n.nid", array( ':status' => CommentInterface::PUBLISHED, ':h_uid' => $user->id(), ':nids[]' => $nids, - ':timestamp' => HISTORY_READ_LIMIT, + ':timestamp1' => HISTORY_READ_LIMIT, + ':timestamp2' => HISTORY_READ_LIMIT, )); foreach ($result as $node) { foreach ($ids[$node->id()] as $id) { -- GitLab