diff --git a/core/modules/comment/comment.pages.inc b/core/modules/comment/comment.pages.inc index bac078b3ec7590b04ae8122c4507bd3e11958bef..0832eff0157d4c758c6d13443a3f9326c9ac2f94 100644 --- a/core/modules/comment/comment.pages.inc +++ b/core/modules/comment/comment.pages.inc @@ -51,7 +51,7 @@ function comment_reply(Node $node, $pid = NULL) { if (user_access('access comments')) { // Load the parent comment. $comment = comment_load($pid); - if ($comment->status = COMMENT_PUBLISHED) { + if ($comment->status == COMMENT_PUBLISHED) { // If that comment exists, make sure that the current comment and the // parent comment both belong to the same parent node. if ($comment->nid != $node->nid) { diff --git a/core/modules/comment/comment.test b/core/modules/comment/comment.test index a791b2d599dce5d9e1cbc3bfeedb1cb0e6f1513c..1ede06328f65a1654e1cdc9db3e9b7c5e550f78b 100644 --- a/core/modules/comment/comment.test +++ b/core/modules/comment/comment.test @@ -123,6 +123,12 @@ class CommentInterfaceTest extends CommentTestBase { $this->assertTrue($this->commentExists($reply, TRUE), t('Page two exists. %s')); $this->setCommentsPerPage(50); + // Attempt to reply to an unpublished comment. + $reply_loaded->status = COMMENT_NOT_PUBLISHED; + $reply_loaded->save(); + $this->drupalGet('comment/reply/' . $this->node->nid . '/' . $reply_loaded->cid); + $this->assertText(t('The comment you are replying to does not exist.'), 'Replying to an unpublished comment'); + // Attempt to post to node with comments disabled. $this->node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'comment' => COMMENT_NODE_HIDDEN)); $this->assertTrue($this->node, t('Article node created.'));