1
1
Fork 0

Bugfixing empty password setting

This commit is contained in:
Philipp Holzer 2019-06-10 15:39:21 +02:00
parent 357d9b5108
commit 4666b18e5b
No known key found for this signature in database
GPG key ID: D8365C3D36B77D90
2 changed files with 18 additions and 1 deletions

View file

@ -94,7 +94,8 @@ class ConfigCache implements IConfigCache, IPConfigCache
} }
if ($this->hidePasswordOutput && if ($this->hidePasswordOutput &&
$key == 'password') { $key == 'password' &&
!empty($value)) {
$this->config[$cat][$key] = new HiddenString($value); $this->config[$cat][$key] = new HiddenString($value);
} else { } else {
$this->config[$cat][$key] = $value; $this->config[$cat][$key] = $value;

View file

@ -309,4 +309,20 @@ class ConfigCacheTest extends MockedTest
$this->assertEquals('supersecure', print_r($configCache->get('database', 'password'), true)); $this->assertEquals('supersecure', print_r($configCache->get('database', 'password'), true));
$this->assertEquals('notsecured', print_r($configCache->get('database', 'username'), 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'));
}
} }