diff --git a/core/lib/Drupal/Core/EventSubscriber/PathSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/PathSubscriber.php
index e0f6822..6e5b7a9 100644
--- a/core/lib/Drupal/Core/EventSubscriber/PathSubscriber.php
+++ b/core/lib/Drupal/Core/EventSubscriber/PathSubscriber.php
@@ -81,6 +81,8 @@ public function onKernelRequestFrontPageResolve(GetResponseEvent $event) {
    *   The Event to process.
    */
   public function onKernelRequestLanguageResolve(GetResponseEvent $event) {
+    // We need to act only on the master request, otherwise subrequests will
+    // inherit the main request path and an infinite loop will be started.
     if ($event->getRequestType() == HttpKernelInterface::MASTER_REQUEST) {
       $path = _language_resolved_path();
       if ($path !== NULL) {
diff --git a/core/modules/language/tests/language_test.module b/core/modules/language/tests/language_test.module
index db5574c..4355852 100644
--- a/core/modules/language/tests/language_test.module
+++ b/core/modules/language/tests/language_test.module
@@ -129,7 +129,5 @@ function language_test_menu() {
  * Page callback. Uses a subrequest to retrieve the 'user' page.
  */
 function language_test_subrequest() {
-  $request = drupal_container()->get('request');
-  $subrequest = Request::create('/user');
-  return drupal_container()->get('http_kernel')->handle($subrequest, HttpKernelInterface::SUB_REQUEST);
+  return drupal_container()->get('http_kernel')->handle(Request::create('/user'), HttpKernelInterface::SUB_REQUEST);
 }
