Bugfixing empty password setting
This commit is contained in:
parent
357d9b5108
commit
4666b18e5b
2 changed files with 18 additions and 1 deletions
|
@ -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;
|
||||
|
|
|
@ -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'));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue