Skip to content

Index arrays in config is not overrided correctly #7

@andser

Description

@andser

Hello!
Trying to use your lib, but faced a problem:

require 'vendor/autoload.php';

use PHLAK\Config\Config;

$array1 = [
	'assoc_key' => 'testvalue',
	'key' => [1,2,3,4],
];
$array2 = [
	'assoc_key' => 'override',
	'key' => ['somevalue'],
];

$config1 = new Config($array1);
$config2 = new Config($array2);
print_r($config1->merge($config2)->toArray());

It returns:

Array
(
    [assoc_key] => override
    [key] => Array
        (
            [0] => somevalue
            [1] => 2
            [2] => 3
            [3] => 4
        )

)

But should return:

Array
(
    [assoc_key] => override
    [key] => Array
        (
            [0] => somevalue
        )

)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions