aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2024-03-13 14:05:58 +0100
committerMario <mario@mariovavti.com>2024-03-13 14:05:58 +0100
commit328ce0a837f596ef53895e272301aff3c2f7c84e (patch)
tree4d732374ce60dedcd3ce5be38b5f33c7fea0e9df /tests/unit
parent34e24ea5e917b80eb1f149706fc019d3ec1e31fc (diff)
downloadvolse-hubzilla-328ce0a837f596ef53895e272301aff3c2f7c84e.tar.gz
volse-hubzilla-328ce0a837f596ef53895e272301aff3c2f7c84e.tar.bz2
volse-hubzilla-328ce0a837f596ef53895e272301aff3c2f7c84e.zip
fix another regression from last Lib/Config refactor which returned the default falue in case the value was an array. also add a testcase for this situation
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/Lib/ConfigTest.php12
1 files changed, 12 insertions, 0 deletions
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.
*/