From c86d7ad0c979ab75cde105d6023bf61e13afb61a Mon Sep 17 00:00:00 2001
From: Alex Pott <alex.a.pott@googlemail.com>
Date: Tue, 30 Aug 2022 15:22:44 +0100
Subject: [PATCH] Issue #3304991 by bradjones1, andypost, catch: [Symfony 6]
 HttpKernel should opt-in to catching `\Throwable`

---
 core/core.services.yml                                        | 2 +-
 .../Drupal/Core/Form/EventSubscriber/FormAjaxSubscriber.php   | 4 ++--
 core/lib/Drupal/Core/Installer/InstallerRedirectTrait.php     | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/core/core.services.yml b/core/core.services.yml
index 3f76a3e37e66..2fa0b45bd5d3 100644
--- a/core/core.services.yml
+++ b/core/core.services.yml
@@ -736,7 +736,7 @@ services:
     class: Drupal\Core\StackMiddleware\StackedHttpKernel
   http_kernel.basic:
     class: Symfony\Component\HttpKernel\HttpKernel
-    arguments: ['@event_dispatcher', '@controller_resolver', '@request_stack', '@http_kernel.controller.argument_resolver']
+    arguments: ['@event_dispatcher', '@controller_resolver', '@request_stack', '@http_kernel.controller.argument_resolver', true]
   http_kernel.controller.argument_resolver:
     class: Symfony\Component\HttpKernel\Controller\ArgumentResolver
     arguments: ['@http_kernel.controller.argument_metadata_factory', ['@argument_resolver.request_attribute', '@argument_resolver.request', '@argument_resolver.psr7_request', '@argument_resolver.route_match', '@argument_resolver.default']]
diff --git a/core/lib/Drupal/Core/Form/EventSubscriber/FormAjaxSubscriber.php b/core/lib/Drupal/Core/Form/EventSubscriber/FormAjaxSubscriber.php
index f21cefae6582..75b12bf30f3f 100644
--- a/core/lib/Drupal/Core/Form/EventSubscriber/FormAjaxSubscriber.php
+++ b/core/lib/Drupal/Core/Form/EventSubscriber/FormAjaxSubscriber.php
@@ -124,13 +124,13 @@ public function onException(ExceptionEvent $event) {
   /**
    * Extracts a form AJAX exception.
    *
-   * @param \Exception $e
+   * @param \Throwable $e
    *   A generic exception that might contain a form AJAX exception.
    *
    * @return \Drupal\Core\Form\FormAjaxException|null
    *   Either the form AJAX exception, or NULL if none could be found.
    */
-  protected function getFormAjaxException(\Exception $e) {
+  protected function getFormAjaxException(\Throwable $e) {
     $exception = NULL;
     while ($e) {
       if ($e instanceof FormAjaxException) {
diff --git a/core/lib/Drupal/Core/Installer/InstallerRedirectTrait.php b/core/lib/Drupal/Core/Installer/InstallerRedirectTrait.php
index 44be3c75a49c..4dbb485a93a3 100644
--- a/core/lib/Drupal/Core/Installer/InstallerRedirectTrait.php
+++ b/core/lib/Drupal/Core/Installer/InstallerRedirectTrait.php
@@ -26,7 +26,7 @@ protected function isCli() {
   /**
    * Determines if an exception handler should redirect to the installer.
    *
-   * @param \Exception $exception
+   * @param \Throwable $exception
    *   The exception to check.
    * @param \Drupal\Core\Database\Connection|null $connection
    *   (optional) The default database connection. If not provided, a less
@@ -38,7 +38,7 @@ protected function isCli() {
    *   TRUE if the exception handler should redirect to the installer because
    *   Drupal is not installed yet, or FALSE otherwise.
    */
-  protected function shouldRedirectToInstaller(\Exception $exception, Connection $connection = NULL) {
+  protected function shouldRedirectToInstaller(\Throwable $exception, Connection $connection = NULL) {
     // Never redirect on the command line.
     if ($this->isCli()) {
       return FALSE;
-- 
GitLab