From 910bda621643c05efa0aefee7af7ead76fac3d36 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stephan=20Gro=C3=9Fberndt?= <stephan.grossberndt@typo3.org>
Date: Mon, 27 Apr 2020 13:34:18 +0200
Subject: [PATCH] [BUGFIX] Do not disable caching for caches with
 TransientMemoryBackend
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

If caching is disabled in the CacheManager, caches using the
TransientMemoryBackend are not adjusted to NullBackend anymore.

This mainly affects the runtime cache, which is memory-based anyways
and should be a "forget after the request"-cache.

This also fixes a PDOException in the page slug update wizard when
using PostgreSQL, as the Install Tool is using the core in "no-cache"
mode. (See entry point of the Install Tool)

Resolves: #91206
Releases: master, 9.5
Change-Id: Id9085bd85bdbf321ef210c75c2bb8aefc6f5f061
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/64320
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Stephan Großberndt <stephan.grossberndt@typo3.org>
Reviewed-by: Benjamin Franzke <bfr@qbus.de>
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Stephan Großberndt <stephan.grossberndt@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Benjamin Franzke <bfr@qbus.de>
---
 typo3/sysext/core/Classes/Cache/CacheManager.php | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/typo3/sysext/core/Classes/Cache/CacheManager.php b/typo3/sysext/core/Classes/Cache/CacheManager.php
index 1fe7d60db1e8..62ed306d186f 100644
--- a/typo3/sysext/core/Classes/Cache/CacheManager.php
+++ b/typo3/sysext/core/Classes/Cache/CacheManager.php
@@ -17,6 +17,7 @@ namespace TYPO3\CMS\Core\Cache;
 
 use TYPO3\CMS\Core\Cache\Backend\BackendInterface;
 use TYPO3\CMS\Core\Cache\Backend\NullBackend;
+use TYPO3\CMS\Core\Cache\Backend\TransientMemoryBackend;
 use TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend;
 use TYPO3\CMS\Core\Cache\Exception\DuplicateIdentifierException;
 use TYPO3\CMS\Core\Cache\Exception\InvalidBackendException;
@@ -306,7 +307,7 @@ class CacheManager implements SingletonInterface
             $backendOptions = $this->defaultCacheConfiguration['options'];
         }
 
-        if ($this->disableCaching) {
+        if ($this->disableCaching && $backend !== TransientMemoryBackend::class) {
             $backend = NullBackend::class;
             $backendOptions = [];
         }
-- 
GitLab