diff --git a/core/modules/toolbar/toolbar.module b/core/modules/toolbar/toolbar.module
index 3d3f075..e79b409 100644
--- a/core/modules/toolbar/toolbar.module
+++ b/core/modules/toolbar/toolbar.module
@@ -134,7 +134,7 @@ function _toolbar_initialize_page_cache() {
     $request = \Drupal::request();
     $response->headers->set('X-Drupal-Cache', 'HIT');
     // Restore the metadata cached with the page.
-    $_GET['q'] = $cache->data['path'];
+    $request->query->set('q', $cache->data['path']);
     date_default_timezone_set(drupal_get_user_timezone());
 
     drupal_serve_page_from_cache($cache, $response, $request);
