diff --git a/core/modules/history/history.module b/core/modules/history/history.module
index a3842fc..3c0a228 100644
--- a/core/modules/history/history.module
+++ b/core/modules/history/history.module
@@ -99,7 +99,7 @@ function history_read_multiple($nids) {
  *   current user.
  */
 function history_write($nid, $account = NULL) {
-  global $user;
+  $user = \Drupal::currentUser();
 
   if (!isset($account)) {
     $account = $user;
diff --git a/core/modules/history/lib/Drupal/history/Plugin/views/field/HistoryUserTimestamp.php b/core/modules/history/lib/Drupal/history/Plugin/views/field/HistoryUserTimestamp.php
index 91db271..7065a49 100644
--- a/core/modules/history/lib/Drupal/history/Plugin/views/field/HistoryUserTimestamp.php
+++ b/core/modules/history/lib/Drupal/history/Plugin/views/field/HistoryUserTimestamp.php
@@ -31,7 +31,7 @@ class HistoryUserTimestamp extends Node {
   public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
     parent::init($view, $display, $options);
 
-    global $user;
+    $user = \Drupal::currentUser();
     if ($user->isAuthenticated()) {
       $this->additional_fields['created'] = array('table' => 'node_field_data', 'field' => 'created');
       $this->additional_fields['changed'] = array('table' => 'node_field_data', 'field' => 'changed');
@@ -62,7 +62,7 @@ public function buildOptionsForm(&$form, &$form_state) {
 
   public function query() {
     // Only add ourselves to the query if logged in.
-    global $user;
+    $user = \Drupal::currentUser();
     if ($user->isAnonymous()) {
       return;
     }
@@ -77,7 +77,7 @@ public function render(ResultRow $values) {
     // This code shadows node_mark, but it reads from the db directly and
     // we already have that info.
     $mark = MARK_READ;
-    global $user;
+    $user = \Drupal::currentUser();
     if ($user->isAuthenticated()) {
       $last_read = $this->getValue($values);
       $changed = $this->getValue($values, 'changed');
diff --git a/core/modules/history/lib/Drupal/history/Plugin/views/filter/HistoryUserTimestamp.php b/core/modules/history/lib/Drupal/history/Plugin/views/filter/HistoryUserTimestamp.php
index 20eaac4..5fd3fe5 100644
--- a/core/modules/history/lib/Drupal/history/Plugin/views/filter/HistoryUserTimestamp.php
+++ b/core/modules/history/lib/Drupal/history/Plugin/views/filter/HistoryUserTimestamp.php
@@ -53,7 +53,7 @@ protected function valueForm(&$form, &$form_state) {
   }
 
   public function query() {
-    global $user;
+    $user = \Drupal::currentUser();
     // This can only work if we're authenticated in.
     if (!$user->isAuthenticated()) {
       return;
diff --git a/core/modules/history/lib/Drupal/history/Tests/Views/HistoryTimestampTest.php b/core/modules/history/lib/Drupal/history/Tests/Views/HistoryTimestampTest.php
index 182174c..9748b99 100644
--- a/core/modules/history/lib/Drupal/history/Tests/Views/HistoryTimestampTest.php
+++ b/core/modules/history/lib/Drupal/history/Tests/Views/HistoryTimestampTest.php
@@ -49,7 +49,6 @@ public function testHandlers() {
 
     $account = $this->drupalCreateUser();
     $this->drupalLogin($account);
-    $GLOBALS['user'] = $account;
 
     db_insert('history')
       ->fields(array(
