From 9260215091ec1d52efc47df6abc5fdb0740111c6 Mon Sep 17 00:00:00 2001 From: Aselsan Date: Sat, 15 Nov 2025 17:47:02 +0700 Subject: [PATCH 1/4] fix: override merging behaviour --- system/Config/BaseConfig.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/Config/BaseConfig.php b/system/Config/BaseConfig.php index ce6594d45d36..b5c8198b2823 100644 --- a/system/Config/BaseConfig.php +++ b/system/Config/BaseConfig.php @@ -291,7 +291,7 @@ protected function registerProperties() foreach ($properties as $property => $value) { if (isset($this->{$property}) && is_array($this->{$property}) && is_array($value)) { - $this->{$property} = array_merge($this->{$property}, $value); + $this->{$property} = array_replace_recursive($this->{$property}, $value); } else { $this->{$property} = $value; } From 8cfee33173f2dd6918983c4a1e56af8b6bf6fd86 Mon Sep 17 00:00:00 2001 From: warcooft Date: Sat, 15 Nov 2025 20:06:08 +0700 Subject: [PATCH 2/4] fix: add test --- system/Config/BaseConfig.php | 6 +++--- tests/_support/Config/TestRegistrar.php | 3 +++ tests/system/Config/BaseConfigTest.php | 3 +++ tests/system/Config/fixtures/RegistrarConfig.php | 7 +++++++ 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/system/Config/BaseConfig.php b/system/Config/BaseConfig.php index b5c8198b2823..b71d48286a07 100644 --- a/system/Config/BaseConfig.php +++ b/system/Config/BaseConfig.php @@ -246,8 +246,8 @@ protected function registerProperties() if (static::$discovering) { throw new ConfigException( 'During Auto-Discovery of Registrars,' - . ' "' . static::class . '" executes Auto-Discovery again.' - . ' "' . clean_path(static::$registrarFile) . '" seems to have bad code.', + . ' "' . static::class . '" executes Auto-Discovery again.' + . ' "' . clean_path(static::$registrarFile) . '" seems to have bad code.', ); } @@ -291,7 +291,7 @@ protected function registerProperties() foreach ($properties as $property => $value) { if (isset($this->{$property}) && is_array($this->{$property}) && is_array($value)) { - $this->{$property} = array_replace_recursive($this->{$property}, $value); + $this->{$property} = array_merge_recursive($this->{$property}, $value); } else { $this->{$property} = $value; } diff --git a/tests/_support/Config/TestRegistrar.php b/tests/_support/Config/TestRegistrar.php index 806fd1518402..19e870e2923b 100644 --- a/tests/_support/Config/TestRegistrar.php +++ b/tests/_support/Config/TestRegistrar.php @@ -27,6 +27,9 @@ public static function RegistrarConfig() 'first', 'second', ], + 'baz' => [ + 'bar' => 'ber' + ] ]; } } diff --git a/tests/system/Config/BaseConfigTest.php b/tests/system/Config/BaseConfigTest.php index 9158db34140f..7d6a36f9e474 100644 --- a/tests/system/Config/BaseConfigTest.php +++ b/tests/system/Config/BaseConfigTest.php @@ -270,6 +270,9 @@ public function testRegistrars(): void $this->assertSame('bar', $config->foo); // add to an existing array property $this->assertSame(['baz', 'first', 'second'], $config->bar); + + // add to an existing nested array property + $this->assertSame(['foo', 'bar' => ['bir', 'bur', 'ber']], $config->baz); } public function testBadRegistrar(): void diff --git a/tests/system/Config/fixtures/RegistrarConfig.php b/tests/system/Config/fixtures/RegistrarConfig.php index c2ea35927228..077ba9ed1afe 100644 --- a/tests/system/Config/fixtures/RegistrarConfig.php +++ b/tests/system/Config/fixtures/RegistrarConfig.php @@ -19,4 +19,11 @@ class RegistrarConfig extends BaseConfig public $bar = [ 'baz', ]; + public $baz = [ + 'foo', + 'bar' => [ + 'bir', + 'bur' + ] + ]; } From a981215a8467c5ad14b1d1ae17a355a4c6923b07 Mon Sep 17 00:00:00 2001 From: warcooft Date: Sat, 15 Nov 2025 20:10:17 +0700 Subject: [PATCH 3/4] fix: apply cs-fix --- tests/_support/Config/TestRegistrar.php | 4 ++-- tests/system/Config/fixtures/RegistrarConfig.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/_support/Config/TestRegistrar.php b/tests/_support/Config/TestRegistrar.php index 19e870e2923b..0eceef253651 100644 --- a/tests/_support/Config/TestRegistrar.php +++ b/tests/_support/Config/TestRegistrar.php @@ -28,8 +28,8 @@ public static function RegistrarConfig() 'second', ], 'baz' => [ - 'bar' => 'ber' - ] + 'bar' => 'ber', + ], ]; } } diff --git a/tests/system/Config/fixtures/RegistrarConfig.php b/tests/system/Config/fixtures/RegistrarConfig.php index 077ba9ed1afe..1a7279b392a8 100644 --- a/tests/system/Config/fixtures/RegistrarConfig.php +++ b/tests/system/Config/fixtures/RegistrarConfig.php @@ -23,7 +23,7 @@ class RegistrarConfig extends BaseConfig 'foo', 'bar' => [ 'bir', - 'bur' - ] + 'bur', + ], ]; } From 87a484e9a12fee3c0efd27c183d24cda332235c3 Mon Sep 17 00:00:00 2001 From: warcooft Date: Sat, 15 Nov 2025 20:15:04 +0700 Subject: [PATCH 4/4] fix: missing type property --- tests/system/Config/fixtures/RegistrarConfig.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/system/Config/fixtures/RegistrarConfig.php b/tests/system/Config/fixtures/RegistrarConfig.php index 1a7279b392a8..17e4ff05ff96 100644 --- a/tests/system/Config/fixtures/RegistrarConfig.php +++ b/tests/system/Config/fixtures/RegistrarConfig.php @@ -19,7 +19,7 @@ class RegistrarConfig extends BaseConfig public $bar = [ 'baz', ]; - public $baz = [ + public array $baz = [ 'foo', 'bar' => [ 'bir',