diff options
author | Mario <mario@mariovavti.com> | 2024-03-13 14:05:58 +0100 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2024-03-13 14:05:58 +0100 |
commit | 328ce0a837f596ef53895e272301aff3c2f7c84e (patch) | |
tree | 4d732374ce60dedcd3ce5be38b5f33c7fea0e9df /tests/unit | |
parent | 34e24ea5e917b80eb1f149706fc019d3ec1e31fc (diff) | |
download | volse-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.php | 12 |
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. */ |