diff --git a/core/modules/toolbar/toolbar.module b/core/modules/toolbar/toolbar.module
index 5bc4534..149e095 100644
--- a/core/modules/toolbar/toolbar.module
+++ b/core/modules/toolbar/toolbar.module
@@ -130,7 +130,7 @@ function _toolbar_initialize_page_cache() {
   if (is_object($cache)) {
     header('X-Drupal-Cache: HIT');
     // Restore the metadata cached with the page.
-    $_GET['q'] = $cache->data['path'];
+    Drupal::request()->query->set('q', $cache->data['path']);
     date_default_timezone_set(drupal_get_user_timezone());
 
     drupal_serve_page_from_cache($cache);
