diff --git a/src/Core/Config/Cache/ConfigCache.php b/src/Core/Config/Cache/ConfigCache.php index 9aea367d9..c3cec19e2 100644 --- a/src/Core/Config/Cache/ConfigCache.php +++ b/src/Core/Config/Cache/ConfigCache.php @@ -94,7 +94,8 @@ class ConfigCache implements IConfigCache, IPConfigCache } if ($this->hidePasswordOutput && - $key == 'password') { + $key == 'password' && + !empty($value)) { $this->config[$cat][$key] = new HiddenString($value); } else { $this->config[$cat][$key] = $value; diff --git a/tests/src/Core/Config/Cache/ConfigCacheTest.php b/tests/src/Core/Config/Cache/ConfigCacheTest.php index 76ee26438..11845379d 100644 --- a/tests/src/Core/Config/Cache/ConfigCacheTest.php +++ b/tests/src/Core/Config/Cache/ConfigCacheTest.php @@ -309,4 +309,20 @@ class ConfigCacheTest extends MockedTest $this->assertEquals('supersecure', print_r($configCache->get('database', 'password'), true)); $this->assertEquals('notsecured', print_r($configCache->get('database', 'username'), true)); } + + /** + * Test a empty password + */ + public function testEmptyPassword() + { + $confiCache = new ConfigCache([ + 'database' => [ + 'password' => '', + 'username' => '', + ] + ]); + + $this->assertEmpty($confiCache->get('database', 'password')); + $this->assertEmpty($confiCache->get('database', 'username')); + } }