From 328ce0a837f596ef53895e272301aff3c2f7c84e Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 13 Mar 2024 14:05:58 +0100 Subject: 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 --- tests/unit/Lib/ConfigTest.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests') 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, ), ); @@ -50,6 +51,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. -- cgit v1.2.3