From d9b2c19d003e6615fe6cee6c393ecc04d9df069a Mon Sep 17 00:00:00 2001
From: Kasper Ligaard <kasperligaard+typo3.org@gmail.com>
Date: Tue, 20 Jun 2017 11:36:20 +0200
Subject: [PATCH] [BUGFIX] Always select database number in Redis Cache Backend

When using persistent connections, we need to always select the database.

Resolves: #81629
Releases: master, 8.7
Change-Id: Ia514a8ed8f04d1108263c39a21c654de4191db8b
Reviewed-on: https://review.typo3.org/53273
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Thomas Hohn <thomas@hohn.dk>
Tested-by: Thomas Hohn <thomas@hohn.dk>
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Reviewed-by: Joerg Boesche <typo3@joergboesche.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
---
 typo3/sysext/core/Classes/Cache/Backend/RedisBackend.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/typo3/sysext/core/Classes/Cache/Backend/RedisBackend.php b/typo3/sysext/core/Classes/Cache/Backend/RedisBackend.php
index 4330bcc3acde..32dfc73d544e 100644
--- a/typo3/sysext/core/Classes/Cache/Backend/RedisBackend.php
+++ b/typo3/sysext/core/Classes/Cache/Backend/RedisBackend.php
@@ -168,7 +168,7 @@ class RedisBackend extends AbstractBackend implements TaggableBackendInterface
                     throw new \TYPO3\CMS\Core\Cache\Exception('The given password was not accepted by the redis server.', 1279765134);
                 }
             }
-            if ($this->database > 0) {
+            if ($this->database >= 0) {
                 $success = $this->redis->select($this->database);
                 if (!$success) {
                     throw new \TYPO3\CMS\Core\Cache\Exception('The given database "' . $this->database . '" could not be selected.', 1279765144);
-- 
GitLab