From 5166cca9d50444f7aa76ccaafbb37ab2068c71b0 Mon Sep 17 00:00:00 2001
From: Andreas Kienast <a.fernandez@scripting-base.de>
Date: Fri, 15 Mar 2024 09:22:59 +0100
Subject: [PATCH] [BUGFIX] Bail out if `AbstractExceptionHandler` cannot write
 logs

If an exception cannot get written into the database, e.g. due to
connectivity issues, exceptions are already caught. However, this
doesn't work on low-level errors that may arise if e.g. the DI container
is defunct, required by `ConnectionPool` internals.

The exception handling is changed to cover all `\Throwable`s.

Resolves: #103402
Releases: main
Change-Id: I52ce0e91e7f3297893928d6d1b79616b34e85798
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/83471
Reviewed-by: Christoph Lehmann <christoph.lehmann@networkteam.com>
Reviewed-by: Oliver Hader <oliver.hader@typo3.org>
Tested-by: core-ci <typo3@b13.com>
Tested-by: Benjamin Franzke <ben@bnf.dev>
Tested-by: Oliver Hader <oliver.hader@typo3.org>
Reviewed-by: Andreas Kienast <a.fernandez@scripting-base.de>
Reviewed-by: Benjamin Franzke <ben@bnf.dev>
Tested-by: Andreas Kienast <a.fernandez@scripting-base.de>
---
 typo3/sysext/core/Classes/Error/AbstractExceptionHandler.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/typo3/sysext/core/Classes/Error/AbstractExceptionHandler.php b/typo3/sysext/core/Classes/Error/AbstractExceptionHandler.php
index 7ab61b64d9de..602a456a1ab5 100644
--- a/typo3/sysext/core/Classes/Error/AbstractExceptionHandler.php
+++ b/typo3/sysext/core/Classes/Error/AbstractExceptionHandler.php
@@ -129,7 +129,7 @@ abstract class AbstractExceptionHandler implements ExceptionHandlerInterface, Si
         try {
             // Write error message to sys_log table
             $this->writeLog($logTitle . ': ' . $logMessage);
-        } catch (\Exception $exception) {
+        } catch (\Throwable $exception) {
         }
     }
 
-- 
GitLab