Merge pull request #11250 from nupplaphil/bug/redis_pw

Don't use empty values for redis password and port
This commit is contained in:
Hypolite Petovan 2022-02-15 20:15:06 -05:00 committed by GitHub
commit 7dadc7f6dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View File

@ -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'));
}
}

View File

@ -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);
}

View File

@ -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()