diff --git a/core/composer.json b/core/composer.json index 79019a8cf6..1b185cbe0f 100644 --- a/core/composer.json +++ b/core/composer.json @@ -196,6 +196,7 @@ "lib/Drupal/Core/DependencyInjection/Container.php", "lib/Drupal/Core/DrupalKernel.php", "lib/Drupal/Core/DrupalKernelInterface.php", + "lib/Drupal/Core/Http/InputBag.php", "lib/Drupal/Core/Installer/InstallerRedirectTrait.php", "lib/Drupal/Core/Site/Settings.php" ], diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php index 5f936c9874..599e13833a 100644 --- a/core/lib/Drupal/Core/DrupalKernel.php +++ b/core/lib/Drupal/Core/DrupalKernel.php @@ -591,14 +591,6 @@ public function preHandle(Request $request) { // Initialize legacy request globals. $this->initializeRequestGlobals($request); - // Replace ParameterBag with InputBag for compatibility with Symfony 5. - // @todo Remove this when Symfony 4 is no longer supported. - foreach (['request', 'query', 'cookies'] as $bag) { - if (!($bag instanceof SymfonyInputBag)) { - $request->$bag = new InputBag($request->$bag->all()); - } - } - // Put the request on the stack. $this->container->get('request_stack')->push($request); @@ -702,6 +694,14 @@ public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = // Ensure sane PHP environment variables. static::bootEnvironment(); + // Replace ParameterBag with InputBag for compatibility with Symfony 5. + // @todo Remove this when Symfony 4 is no longer supported. + foreach (['request', 'query', 'cookies'] as $bag) { + if (!($bag instanceof SymfonyInputBag)) { + $request->$bag = new InputBag($request->$bag->all()); + } + } + try { $this->initializeSettings($request);