"mobiledetect/mobiledetectlib": "2.8.*",
"monolog/monolog": "^1.24",
"nikic/fast-route": "^1.3",
+ "paragonie/hidden-string": "^1.0",
"pear/text_languagedetect": "1.*",
"pragmarx/google2fa": "^5.0",
"pragmarx/recovery": "^0.1.0",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "67821d2270bdf8cdd24e7a047b9544e7",
+ "content-hash": "eb985236d64ed0b0fe1fc2e4ac6616e2",
"packages": [
{
"name": "asika/simple-console",
},
{
"name": "paragonie/constant_time_encoding",
- "version": "v1.0.4",
+ "version": "v2.2.3",
"source": {
"type": "git",
"url": "https://github.com/paragonie/constant_time_encoding.git",
- "reference": "2132f0f293d856026d7d11bd81b9f4a23a1dc1f6"
+ "reference": "55af0dc01992b4d0da7f6372e2eac097bbbaffdb"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/paragonie/constant_time_encoding/zipball/2132f0f293d856026d7d11bd81b9f4a23a1dc1f6",
- "reference": "2132f0f293d856026d7d11bd81b9f4a23a1dc1f6",
+ "url": "https://api.github.com/repos/paragonie/constant_time_encoding/zipball/55af0dc01992b4d0da7f6372e2eac097bbbaffdb",
+ "reference": "55af0dc01992b4d0da7f6372e2eac097bbbaffdb",
"shasum": ""
},
"require": {
- "php": "^5.3|^7"
+ "php": "^7"
},
"require-dev": {
- "paragonie/random_compat": "^1.4|^2",
- "phpunit/phpunit": "4.*|5.*",
- "vimeo/psalm": "^0.3|^1"
+ "phpunit/phpunit": "^6|^7",
+ "vimeo/psalm": "^1|^2"
},
"type": "library",
"autoload": {
"hex2bin",
"rfc4648"
],
- "time": "2018-04-30T17:57:16+00:00"
+ "time": "2019-01-03T20:26:31+00:00"
+ },
+ {
+ "name": "paragonie/hidden-string",
+ "version": "v1.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/paragonie/hidden-string.git",
+ "reference": "0bbb00be0e33b8e1d48fa79ea35cd42d3091a936"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/paragonie/hidden-string/zipball/0bbb00be0e33b8e1d48fa79ea35cd42d3091a936",
+ "reference": "0bbb00be0e33b8e1d48fa79ea35cd42d3091a936",
+ "shasum": ""
+ },
+ "require": {
+ "paragonie/constant_time_encoding": "^2",
+ "paragonie/sodium_compat": "^1.6",
+ "php": "^7"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^6|^7",
+ "vimeo/psalm": "^1"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "ParagonIE\\HiddenString\\": "./src"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MPL-2.0"
+ ],
+ "authors": [
+ {
+ "name": "Paragon Initiative Enterprises",
+ "email": "info@paragonie.com",
+ "homepage": "https://paragonie.com"
+ }
+ ],
+ "description": "Encapsulate strings in an object to hide them from stack traces",
+ "homepage": "https://github.com/paragonie/hidden-string",
+ "keywords": [
+ "hidden",
+ "stack trace",
+ "string"
+ ],
+ "time": "2018-05-07T20:28:06+00:00"
},
{
"name": "paragonie/random_compat",
"version": "v1.6.5",
"source": {
"type": "git",
- "url": "https://github.com/mikey179/vfsStream.git",
+ "url": "https://github.com/bovigo/vfsStream.git",
"reference": "d5fec95f541d4d71c4823bb5e30cf9b9e5b96145"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/mikey179/vfsStream/zipball/d5fec95f541d4d71c4823bb5e30cf9b9e5b96145",
+ "url": "https://api.github.com/repos/bovigo/vfsStream/zipball/d5fec95f541d4d71c4823bb5e30cf9b9e5b96145",
"reference": "d5fec95f541d4d71c4823bb5e30cf9b9e5b96145",
"shasum": ""
},
}
],
"description": "Provides the functionality to compare PHP values for equality",
- "homepage": "http://www.github.com/sebastianbergmann/comparator",
+ "homepage": "https://github.com/sebastianbergmann/comparator",
"keywords": [
"comparator",
"compare",
}
],
"description": "Provides functionality to handle HHVM/PHP environments",
- "homepage": "http://www.github.com/sebastianbergmann/environment",
+ "homepage": "https://github.com/sebastianbergmann/environment",
"keywords": [
"Xdebug",
"environment",
}
],
"description": "Provides the functionality to export PHP variables for visualization",
- "homepage": "http://www.github.com/sebastianbergmann/exporter",
+ "homepage": "https://github.com/sebastianbergmann/exporter",
"keywords": [
"export",
"exporter"
}
],
"description": "Snapshotting of global state",
- "homepage": "http://www.github.com/sebastianbergmann/global-state",
+ "homepage": "https://github.com/sebastianbergmann/global-state",
"keywords": [
"global state"
],
}
],
"description": "Provides functionality to recursively process PHP variables",
- "homepage": "http://www.github.com/sebastianbergmann/recursion-context",
+ "homepage": "https://github.com/sebastianbergmann/recursion-context",
"time": "2016-11-19T07:33:16+00:00"
},
{
},
{
"name": "Gert de Pagter",
- "email": "backendtea@gmail.com"
+ "email": "BackEndTea@gmail.com"
}
],
"description": "Symfony polyfill for ctype functions",
*
*/
- $res = Network::post($dfrn_confirm, $params, null, $redirects, 120)->getBody();
+ $res = Network::post($dfrn_confirm, $params, null, 120)->getBody();
Logger::log(' Confirm: received data: ' . $res, Logger::DATA);
// Check if the URL is an image, video or audio file. If so format
// the URL with the corresponding BBCode media tag
- $redirects = 0;
// Fetch the header of the URL
- $curlResponse = Network::curl($url, false, $redirects, ['novalidate' => true, 'nobody' => true]);
+ $curlResponse = Network::curl($url, false, ['novalidate' => true, 'nobody' => true]);
if ($curlResponse->isSuccess()) {
// Convert the header fields into an array
if (!in_array($ext, $noexts)) {
// try oembed autodiscovery
- $redirects = 0;
- $html_text = Network::fetchUrl($embedurl, false, $redirects, 15, 'text/*');
+ $html_text = Network::fetchUrl($embedurl, false, 15, 'text/*');
if ($html_text) {
$dom = @DOMDocument::loadHTML($html_text);
if ($dom) {
namespace Friendica\Core\Config\Cache;
+use ParagonIE\HiddenString\HiddenString;
+
/**
* The Friendica config cache for the application
* Initial, all *.config.php files are loaded into this cache with the
*/
private $config;
+ /**
+ * @var bool
+ */
+ private $hidePasswordOutput;
+
/**
* @param array $config A initial config array
+ * @param bool $hidePasswordOutput True, if cache variables should take extra care of password values
*/
- public function __construct(array $config = [])
+ public function __construct(array $config = [], $hidePasswordOutput = true)
{
+ $this->hidePasswordOutput = $hidePasswordOutput;
$this->load($config);
}
$this->config[$cat] = [];
}
- $this->config[$cat][$key] = $value;
-
+ if ($this->hidePasswordOutput &&
+ $key == 'password' &&
+ !empty($value) && is_string($value)) {
+ $this->config[$cat][$key] = new HiddenString((string) $value);
+ } else {
+ $this->config[$cat][$key] = $value;
+ }
return true;
}
if (isset($dbvalue)) {
$this->configCache->set($cat, $key, $dbvalue);
- return $dbvalue;
+ unset($dbvalue);
}
}
$searchUrl .= '&page=' . $page;
}
- $red = 0;
- $resultJson = Network::fetchUrl($searchUrl, false, $red, 0, 'application/json');
+ $resultJson = Network::fetchUrl($searchUrl, false, 0, 'application/json');
$results = json_decode($resultJson, true);
}
$url = System::baseUrl()."/worker";
- Network::fetchUrl($url, false, $redirects, 1);
+ Network::fetchUrl($url, false, 1);
}
/**
use Friendica\Database;
use Friendica\Util\Logger\VoidLogger;
use Friendica\Util\Profiler;
+use ParagonIE\HiddenString\HiddenString;
class DBFactory
{
} else {
$db_user = $server['MYSQL_USER'];
}
- $db_pass = (string) $server['MYSQL_PASSWORD'];
+ $db_pass = new HiddenString((string) $server['MYSQL_PASSWORD']);
$db_data = $server['MYSQL_DATABASE'];
}
$webfinger = 'https://' . $addr_parts[1] . '/.well-known/webfinger?resource=acct:' . urlencode($addr);
- $curlResult = Network::curl($webfinger, false, $redirects, ['accept_content' => 'application/jrd+json,application/json']);
+ $curlResult = Network::curl($webfinger, false, ['accept_content' => 'application/jrd+json,application/json']);
if (!$curlResult->isSuccess() || empty($curlResult->getBody())) {
return false;
}
if (!empty($contact)) {
// Contact is blocked at user-level
- if (self::isBlockedByUser($contact['id'], $importer['id'])) {
+ if (!empty($contact['id']) && !empty($importer['id']) &&
+ self::isBlockedByUser($contact['id'], $importer['id'])) {
return false;
}
);
// Try to get an authentication token from the other instance.
- $curlResult = Network::curl($basepath . '/owa', false, $redirects, ['headers' => $headers]);
+ $curlResult = Network::curl($basepath . '/owa', false, ['headers' => $headers]);
if ($curlResult->isSuccess()) {
$j = json_decode($curlResult->getBody(), true);
$url = "http://".$host."/.well-known/host-meta";
$xrd_timeout = Config::get('system', 'xrd_timeout', 20);
- $redirects = 0;
Logger::log("Probing for ".$host, Logger::DEBUG);
$xrd = null;
- $curlResult = Network::curl($ssl_url, false, $redirects, ['timeout' => $xrd_timeout, 'accept_content' => 'application/xrd+xml']);
+ $curlResult = Network::curl($ssl_url, false, ['timeout' => $xrd_timeout, 'accept_content' => 'application/xrd+xml']);
if ($curlResult->isSuccess()) {
$xml = $curlResult->getBody();
$xrd = XML::parseString($xml, false);
}
if (!is_object($xrd)) {
- $curlResult = Network::curl($url, false, $redirects, ['timeout' => $xrd_timeout, 'accept_content' => 'application/xrd+xml']);
+ $curlResult = Network::curl($url, false, ['timeout' => $xrd_timeout, 'accept_content' => 'application/xrd+xml']);
if ($curlResult->isTimeout()) {
Logger::log("Probing timeout for " . $url, Logger::DEBUG);
self::$istimeout = true;
private static function webfinger($url, $type)
{
$xrd_timeout = Config::get('system', 'xrd_timeout', 20);
- $redirects = 0;
- $curlResult = Network::curl($url, false, $redirects, ['timeout' => $xrd_timeout, 'accept_content' => $type]);
+ $curlResult = Network::curl($url, false, ['timeout' => $xrd_timeout, 'accept_content' => $type]);
if ($curlResult->isTimeout()) {
self::$istimeout = true;
return false;
$data = Cache::get($url);
if (is_null($data) || !$data || !is_array($data)) {
- $img_str = Network::fetchUrl($url, true, $redirects, 4);
+ $img_str = Network::fetchUrl($url, true, 4);
if (!$img_str) {
return false;
return HTTPSignature::fetch($url, $uid);
}
- $curlResult = Network::curl($url, false, $redirects, ['accept_content' => 'application/activity+json, application/ld+json']);
+ $curlResult = Network::curl($url, false, ['accept_content' => 'application/activity+json, application/ld+json']);
if (!$curlResult->isSuccess() || empty($curlResult->getBody())) {
return false;
}
{
Logger::log("Process verb ".$item["verb"]." and object-type ".$item["object-type"]." for entrytype ".$entrytype, Logger::DEBUG);
- if (($entrytype == DFRN::TOP_LEVEL)) {
+ if (($entrytype == DFRN::TOP_LEVEL) && !empty($importer['id'])) {
// The filling of the the "contact" variable is done for legcy reasons
// The functions below are partly used by ostatus.php as well - where we have this variable
- $r = q("SELECT * FROM `contact` WHERE `id` = %d", intval($importer["id"]));
- $contact = $r[0];
+ $contact = Contact::select([], ['id' => $importer['id']]);
// Big question: Do we need these functions? They were part of the "consume_feed" function.
// This function once was responsible for DFRN and OStatus.
self::$conv_list[$conversation] = true;
- $curlResult = Network::curl($conversation, false, $redirects, ['accept_content' => 'application/atom+xml, text/html']);
+ $curlResult = Network::curl($conversation, false, ['accept_content' => 'application/atom+xml, text/html']);
if (!$curlResult->isSuccess()) {
return;
}
$stored = false;
- $curlResult = Network::curl($related, false, $redirects, ['accept_content' => 'application/atom+xml, text/html']);
+ $curlResult = Network::curl($related, false, ['accept_content' => 'application/atom+xml, text/html']);
if (!$curlResult->isSuccess()) {
return;
$server_url = str_replace("http://", "https://", $server_url);
// We set the timeout to 20 seconds since this operation should be done in no time if the server was vital
- $curlResult = Network::curl($server_url."/.well-known/host-meta", false, $redirects, ['timeout' => 20]);
+ $curlResult = Network::curl($server_url."/.well-known/host-meta", false, ['timeout' => 20]);
// Quit if there is a timeout.
// But we want to make sure to only quit if we are mostly sure that this server url fits.
$server_url = str_replace("https://", "http://", $server_url);
// We set the timeout to 20 seconds since this operation should be done in no time if the server was vital
- $curlResult = Network::curl($server_url."/.well-known/host-meta", false, $redirects, ['timeout' => 20]);
+ $curlResult = Network::curl($server_url."/.well-known/host-meta", false, ['timeout' => 20]);
// Quit if there is a timeout
if ($curlResult->isTimeout()) {
if (!empty($accesstoken)) {
$api = 'https://instances.social/api/1.0/instances/list?count=0';
$header = ['Authorization: Bearer '.$accesstoken];
- $curlResult = Network::curl($api, false, $redirects, ['headers' => $header]);
+ $curlResult = Network::curl($api, false, ['headers' => $header]);
if ($curlResult->isSuccess()) {
$servers = json_decode($curlResult->getBody(), true);
$curl_opts = $opts;
$curl_opts['header'] = $headers;
- $curlResult = Network::curl($request, false, $redirects, $curl_opts);
+ $curlResult = Network::curl($request, false, $curl_opts);
$return_code = $curlResult->getReturnCode();
Logger::log('Fetched for user ' . $uid . ' from ' . $request . ' returned ' . $return_code, Logger::DEBUG);
*
* @brief Curl wrapper
* @param string $url URL to fetch
- * @param boolean $binary default false
+ * @param bool $binary default false
* TRUE if asked to return binary results (file download)
- * @param integer $redirects The recursion counter for internal use - default 0
- * @param integer $timeout Timeout in seconds, default system config value or 60 seconds
+ * @param int $timeout Timeout in seconds, default system config value or 60 seconds
* @param string $accept_content supply Accept: header with 'accept_content' as the value
* @param string $cookiejar Path to cookie jar file
+ * @param int $redirects The recursion counter for internal use - default 0
*
* @return string The fetched content
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public static function fetchUrl($url, $binary = false, &$redirects = 0, $timeout = 0, $accept_content = null, $cookiejar = '')
+ public static function fetchUrl(string $url, bool $binary = false, int $timeout = 0, string $accept_content = '', string $cookiejar = '', int &$redirects = 0)
{
- $ret = self::fetchUrlFull($url, $binary, $redirects, $timeout, $accept_content, $cookiejar);
+ $ret = self::fetchUrlFull($url, $binary, $timeout, $accept_content, $cookiejar, $redirects);
return $ret->getBody();
}
*
* @brief Curl wrapper with array of return values.
* @param string $url URL to fetch
- * @param boolean $binary default false
+ * @param bool $binary default false
* TRUE if asked to return binary results (file download)
- * @param integer $redirects The recursion counter for internal use - default 0
- * @param integer $timeout Timeout in seconds, default system config value or 60 seconds
+ * @param int $timeout Timeout in seconds, default system config value or 60 seconds
* @param string $accept_content supply Accept: header with 'accept_content' as the value
* @param string $cookiejar Path to cookie jar file
+ * @param int $redirects The recursion counter for internal use - default 0
*
* @return CurlResult With all relevant information, 'body' contains the actual fetched content.
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public static function fetchUrlFull($url, $binary = false, &$redirects = 0, $timeout = 0, $accept_content = null, $cookiejar = '')
+ public static function fetchUrlFull(string $url, bool $binary = false, int $timeout = 0, string $accept_content = '', string $cookiejar = '', int &$redirects = 0)
{
return self::curl(
$url,
$binary,
- $redirects,
- ['timeout'=>$timeout,
- 'accept_content'=>$accept_content,
- 'cookiejar'=>$cookiejar
- ]
+ [
+ 'timeout' => $timeout,
+ 'accept_content' => $accept_content,
+ 'cookiejar' => $cookiejar
+ ],
+ $redirects
);
}
* @brief fetches an URL.
*
* @param string $url URL to fetch
- * @param boolean $binary default false
+ * @param bool $binary default false
* TRUE if asked to return binary results (file download)
- * @param int $redirects The recursion counter for internal use - default 0
* @param array $opts (optional parameters) assoziative array with:
* 'accept_content' => supply Accept: header with 'accept_content' as the value
* 'timeout' => int Timeout in seconds, default system config value or 60 seconds
* 'nobody' => only return the header
* 'cookiejar' => path to cookie jar file
* 'header' => header array
+ * @param int $redirects The recursion counter for internal use - default 0
*
* @return CurlResult
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public static function curl($url, $binary = false, &$redirects = 0, $opts = [])
+ public static function curl(string $url, bool $binary = false, array $opts = [], int &$redirects = 0)
{
$stamp1 = microtime(true);
$redirects++;
Logger::log('curl: redirect ' . $url . ' to ' . $curlResponse->getRedirectUrl());
@curl_close($ch);
- return self::curl($curlResponse->getRedirectUrl(), $binary, $redirects, $opts);
+ return self::curl($curlResponse->getRedirectUrl(), $binary, $opts, $redirects);
}
@curl_close($ch);
* @param string $url URL to post
* @param mixed $params array of POST variables
* @param string $headers HTTP headers
- * @param integer $redirects Recursion counter for internal use - default = 0
- * @param integer $timeout The timeout in seconds, default system config value or 60 seconds
+ * @param int $redirects Recursion counter for internal use - default = 0
+ * @param int $timeout The timeout in seconds, default system config value or 60 seconds
*
* @return CurlResult The content
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public static function post($url, $params, $headers = null, &$redirects = 0, $timeout = 0)
+ public static function post(string $url, $params, string $headers = null, int $timeout = 0, int &$redirects = 0)
{
$stamp1 = microtime(true);
* @return string|boolean The actual working URL, false else
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public static function isUrlValid($url)
+ public static function isUrlValid(string $url)
{
if (Config::get('system', 'disable_url_validation')) {
return $url;
*
* @param string $addr The email address
* @return boolean True if it's a valid email address, false if it's not
- * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public static function isEmailDomainValid($addr)
+ public static function isEmailDomainValid(string $addr)
{
if (Config::get('system', 'disable_email_validation')) {
return true;
*
* @param string $url URL which get tested
* @return boolean True if url is allowed otherwise return false
- * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public static function isUrlAllowed($url)
+ public static function isUrlAllowed(string $url)
{
$h = @parse_url($url);
*
* @return boolean
*/
- public static function isUrlBlocked($url)
+ public static function isUrlBlocked(string $url)
{
$host = @parse_url($url, PHP_URL_HOST);
if (!$host) {
* or if allowed list is not configured
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public static function isEmailDomainAllowed($email)
+ public static function isEmailDomainAllowed(string $email)
{
$domain = strtolower(substr($email, strpos($email, '@') + 1));
if (!$domain) {
* @param array $domain_list
* @return boolean
*/
- public static function isDomainAllowed($domain, array $domain_list)
+ public static function isDomainAllowed(string $domain, array $domain_list)
{
$found = false;
return $found;
}
- public static function lookupAvatarByEmail($email)
+ public static function lookupAvatarByEmail(string $email)
{
$avatar['size'] = 300;
$avatar['email'] = $email;
* @param string $url Any user-submitted URL that may contain tracking params
* @return string The same URL stripped of tracking parameters
*/
- public static function stripTrackingQueryParams($url)
+ public static function stripTrackingQueryParams(string $url)
{
$urldata = parse_url($url);
if (!empty($urldata["query"])) {
* @return string A canonical URL
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public static function finalUrl($url, $depth = 1, $fetchbody = false)
+ public static function finalUrl(string $url, int $depth = 1, bool $fetchbody = false)
{
$a = \get_app();
* @param string $url2
* @return string The matching part
*/
- public static function getUrlMatch($url1, $url2)
+ public static function getUrlMatch(string $url1, string $url2)
{
if (($url1 == "") || ($url2 == "")) {
return "";
*
* @return string The glued URL
*/
- public static function unparseURL($parsed)
+ public static function unparseURL(array $parsed)
{
$get = function ($key) use ($parsed) {
return isset($parsed[$key]) ? $parsed[$key] : null;
*
* @return string switched URL
*/
- public static function switchScheme($url)
+ public static function switchScheme(string $url)
{
$scheme = parse_url($url, PHP_URL_SCHEME);
if (empty($scheme)) {
}
$cookiejar = tempnam(get_temppath(), 'cookiejar-onepoll-');
- $curlResult = Network::curl($contact['poll'], false, $redirects, ['cookiejar' => $cookiejar]);
+ $curlResult = Network::curl($contact['poll'], false, ['cookiejar' => $cookiejar]);
unlink($cookiejar);
if ($curlResult->isTimeout()) {
$this->assertEmpty($configCache->keyDiff($diffConfig));
}
+
+ /**
+ * Test the default hiding of passwords inside the cache
+ */
+ public function testPasswordHide()
+ {
+ $configCache = new ConfigCache([
+ 'database' => [
+ 'password' => 'supersecure',
+ 'username' => 'notsecured',
+ ],
+ ]);
+
+ $this->assertEquals('supersecure', $configCache->get('database', 'password'));
+ $this->assertNotEquals('supersecure', print_r($configCache->get('database', 'password'), true));
+ $this->assertEquals('notsecured', print_r($configCache->get('database', 'username'), true));
+ }
+
+ /**
+ * Test disabling the hiding of passwords inside the cache
+ */
+ public function testPasswordShow()
+ {
+ $configCache = new ConfigCache([
+ 'database' => [
+ 'password' => 'supersecure',
+ 'username' => 'notsecured',
+ ],
+ ], false);
+
+ $this->assertEquals('supersecure', $configCache->get('database', 'password'));
+ $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()
+ {
+ $configCache = new ConfigCache([
+ 'database' => [
+ 'password' => '',
+ 'username' => '',
+ ]
+ ]);
+
+ $this->assertEmpty($configCache->get('database', 'password'));
+ $this->assertEmpty($configCache->get('database', 'username'));
+ }
+
+ public function testWrongTypePassword()
+ {
+ $configCache = new ConfigCache([
+ 'database' => [
+ 'password' => new \stdClass(),
+ 'username' => '',
+ ]
+ ]);
+
+ $this->assertNotEmpty($configCache->get('database', 'password'));
+ $this->assertEmpty($configCache->get('database', 'username'));
+
+ $configCache = new ConfigCache([
+ 'database' => [
+ 'password' => 23,
+ 'username' => '',
+ ]
+ ]);
+
+ $this->assertEquals(23, $configCache->get('database', 'password'));
+ $this->assertEmpty($configCache->get('database', 'username'));
+ }
}