From 4e58c6981cf1e57ed0d07dfb174b6f27ef0736e3 Mon Sep 17 00:00:00 2001 From: Philipp Date: Tue, 15 Feb 2022 23:04:43 +0100 Subject: [PATCH 1/3] Don't use empty, but not null values for redis password and port --- src/Core/Cache/Type/RedisCache.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Core/Cache/Type/RedisCache.php b/src/Core/Cache/Type/RedisCache.php index a58936cfc..a3a5cf7c8 100644 --- a/src/Core/Cache/Type/RedisCache.php +++ b/src/Core/Cache/Type/RedisCache.php @@ -59,13 +59,13 @@ class RedisCache extends AbstractCache implements ICanCacheInMemory $redis_pw = $config->get('system', 'redis_password'); $redis_db = $config->get('system', 'redis_db', 0); - if (isset($redis_port) && !@$this->redis->connect($redis_host, $redis_port)) { + if (!empty($redis_port) && !@$this->redis->connect($redis_host, $redis_port)) { throw new CachePersistenceException('Expected Redis server at ' . $redis_host . ':' . $redis_port . ' isn\'t available'); } elseif (!@$this->redis->connect($redis_host)) { throw new CachePersistenceException('Expected Redis server at ' . $redis_host . ' isn\'t available'); } - if (isset($redis_pw) && !$this->redis->auth($redis_pw)) { + if (!empty($redis_pw) && !$this->redis->auth($redis_pw)) { throw new CachePersistenceException('Cannot authenticate redis server at ' . $redis_host . ':' . $redis_port); } From be240ca5000fa1bd3dd316d2dc7ad34ac53aa4d8 Mon Sep 17 00:00:00 2001 From: Philipp Date: Tue, 15 Feb 2022 23:10:41 +0100 Subject: [PATCH 2/3] Config Console Show 'NULL' for null-values --- src/Console/Config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Console/Config.php b/src/Console/Config.php index 0a38f607f..e32983a68 100644 --- a/src/Console/Config.php +++ b/src/Console/Config.php @@ -151,7 +151,7 @@ HELP; $this->out("{$cat}.{$key}[{$k}] => " . (is_array($v) ? implode(', ', $v) : $v)); } } else { - $this->out("{$cat}.{$key} => " . $value); + $this->out("{$cat}.{$key} => " . ($value ?? 'NULL')); } } From c4e40734df1ff39a4f5be5deeae57db5a39df973 Mon Sep 17 00:00:00 2001 From: Philipp Date: Tue, 15 Feb 2022 23:17:40 +0100 Subject: [PATCH 3/3] adapt test --- tests/src/Console/ConfigConsoleTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/src/Console/ConfigConsoleTest.php b/tests/src/Console/ConfigConsoleTest.php index dd7925ed9..eae622725 100644 --- a/tests/src/Console/ConfigConsoleTest.php +++ b/tests/src/Console/ConfigConsoleTest.php @@ -102,7 +102,7 @@ class ConfigConsoleTest extends ConsoleTest $console->setArgument(0, 'config'); $console->setArgument(1, 'test'); $txt = $this->dumpExecute($console); - self::assertEquals("config.test => \n", $txt); + self::assertEquals("config.test => NULL\n", $txt); } public function testSetArrayValue()