diff --git c/core/modules/comment/comment.module w/core/modules/comment/comment.module index 32adfec..3597db0 100644 --- c/core/modules/comment/comment.module +++ w/core/modules/comment/comment.module @@ -1314,7 +1314,7 @@ function comment_load($cid, $reset = FALSE) { * The number of new comments or FALSE if the user is not logged in. */ function comment_num_new($nid, $timestamp = 0) { - global $user; + $user = Drupal::currentUser(); if ($user->isAuthenticated() && Drupal::moduleHandler()->moduleExists('history')) { // Retrieve the timestamp at which the current user last viewed this node. @@ -1406,7 +1406,7 @@ function comment_get_display_page($cid, $node_type) { * @param Drupal\comment\Comment $comment */ function comment_preview(Comment $comment) { - global $user; + $user = Drupal::currentUser(); $preview_build = array(); if (!form_get_errors()) { @@ -1622,7 +1622,7 @@ function template_preprocess_comment(&$variables) { */ function theme_comment_post_forbidden($variables) { $node = $variables['node']; - global $user; + $user = Drupal::currentUser(); // Since this is expensive to compute, we cache it so that a page with many // comments only has to query the database once for all the links.