]> git.mxchange.org Git - friendica.git/commitdiff
Revert default password setting & using "HiddenString" even for empty strings
authorPhilipp Holzer <admin+github@philipp.info>
Tue, 9 Jul 2019 20:38:54 +0000 (22:38 +0200)
committerPhilipp Holzer <admin+github@philipp.info>
Tue, 9 Jul 2019 20:38:54 +0000 (22:38 +0200)
config/defaults.config.php
src/Core/Config/Cache/ConfigCache.php
tests/src/Core/Config/Cache/ConfigCacheTest.php

index fac08e9843c133d5ab3de2871013cab4353a2f3c..b4471af25caf81b1bf437dbf31637bafd83f1fe8 100644 (file)
@@ -22,7 +22,7 @@ return [
 
                // pass (String)
                // Database user password. Please don't use empty passwords.
-               'password' => new \ParagonIE\HiddenString\HiddenString(''),
+               'password' => '',
 
                // base (String)
                // Database name.
index 441cdee811cc550c3e0bb748c8fdb26887b0dc59..6679b55ab91c8aebe96f2172273fb717fc0ef4c5 100644 (file)
@@ -95,7 +95,7 @@ class ConfigCache implements IConfigCache, IPConfigCache
 
                if ($this->hidePasswordOutput &&
                    $key == 'password' &&
-                   !empty($value) && is_string($value)) {
+                   is_string($value)) {
                        $this->config[$cat][$key] = new HiddenString((string) $value);
                } else {
                        $this->config[$cat][$key] = $value;
index f8f81f9ee721c8193bfbe656d3ad9279efb2bdbf..9c93c44f26c3fda466a2250d54706069239ca0b3 100644 (file)
@@ -4,6 +4,7 @@ namespace Friendica\Test\src\Core\Config\Cache;
 
 use Friendica\Core\Config\Cache\ConfigCache;
 use Friendica\Test\MockedTest;
+use ParagonIE\HiddenString\HiddenString;
 
 class ConfigCacheTest extends MockedTest
 {
@@ -322,7 +323,8 @@ class ConfigCacheTest extends MockedTest
                        ]
                ]);
 
-               $this->assertEmpty($configCache->get('database', 'password'));
+               $this->assertNotEmpty($configCache->get('database', 'password'));
+               $this->assertInstanceOf(HiddenString::class, $configCache->get('database', 'password'));
                $this->assertEmpty($configCache->get('database', 'username'));
        }