aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Zotlabs/Lib/Config.php3
-rw-r--r--tests/unit/Lib/ConfigTest.php12
2 files changed, 15 insertions, 0 deletions
diff --git a/Zotlabs/Lib/Config.php b/Zotlabs/Lib/Config.php
index 933f4bff3..95df8ed6f 100644
--- a/Zotlabs/Lib/Config.php
+++ b/Zotlabs/Lib/Config.php
@@ -143,6 +143,9 @@ class Config {
return $value;
}
}
+ else {
+ return $value;
+ }
}
return $default;
diff --git a/tests/unit/Lib/ConfigTest.php b/tests/unit/Lib/ConfigTest.php
index a8ae3631b..82b4a28bb 100644
--- a/tests/unit/Lib/ConfigTest.php
+++ b/tests/unit/Lib/ConfigTest.php
@@ -20,6 +20,7 @@ class ConfigTest extends Zotlabs\Tests\Unit\UnitTestCase {
'php-array' => 'a:3:{i:0;s:3:"one";i:1;s:3:"two";i:2;s:5:"three";}',
'json-array' => 'json:["one","two","three"]',
'object-injection' => 'a:1:{i:0;O:18:"Zotlabs\Lib\Config":0:{}}',
+ 'unserialized-array' => ['one', 'two', 'three'],
'config_loaded' => true,
),
);
@@ -51,6 +52,17 @@ class ConfigTest extends Zotlabs\Tests\Unit\UnitTestCase {
}
/*
+ * Test that we can retreive old style serialized arrays that were
+ * serialized with th PHP `serialize()` function.
+ */
+ public function testGetPHPUnserializedArray(): void {
+ $this->assertEquals(
+ Zotlabs\Lib\Config::Get('test', 'unserialized-array'),
+ array('one', 'two', 'three')
+ );
+ }
+
+ /*
* Make sure we're not vulnerable to PHP Object injection attacks when
* using the PHP `unserialize()` function.
*/