diff --git a/phalcon/config/adapter/ini.zep b/phalcon/config/adapter/ini.zep index 3ad497613dd..175818ebbbf 100644 --- a/phalcon/config/adapter/ini.zep +++ b/phalcon/config/adapter/ini.zep @@ -96,7 +96,7 @@ class Ini extends Config let sections[] = this->_parseIniString((string)path, lastValue); } if count(sections) { - let config[section] = call_user_func_array("array_merge_recursive", sections); + let config[section] = call_user_func_array("array_replace_recursive", sections); } } else { let config[section] = this->_cast(directives); diff --git a/tests/_data/config/config.ini b/tests/_data/config/config.ini index 9c2268c060b..368a3a71466 100644 --- a/tests/_data/config/config.ini +++ b/tests/_data/config/config.ini @@ -13,4 +13,13 @@ name = demo [test] parent.property = On -parent.property2 = "yeah" \ No newline at end of file +parent.property2 = "yeah" + +[issue-12725] +channel.handlers.0.name = stream +channel.handlers.0.level = debug +channel.handlers.0.fingersCrossed = info +channel.handlers.0.filename = channel.log +channel.handlers.1.name = redis +channel.handlers.1.level = debug +channel.handlers.1.fingersCrossed = info \ No newline at end of file diff --git a/tests/_data/config/config.json b/tests/_data/config/config.json index 938458e2c70..1251cece3cc 100644 --- a/tests/_data/config/config.json +++ b/tests/_data/config/config.json @@ -1 +1,38 @@ -{"phalcon":{"baseuri":"\/phalcon\/"},"models":{"metadata":"memory"},"database":{"adapter":"mysql","host":"localhost","username":"user","password":"passwd","name":"demo"},"test":{"parent":{"property":1,"property2":"yeah"}}} +{ + "phalcon": { + "baseuri": "/phalcon/" + }, + "models": { + "metadata": "memory" + }, + "database": { + "adapter": "mysql", + "host": "localhost", + "username": "user", + "password": "passwd", + "name": "demo" + }, + "test": { + "parent": { + "property": 1, + "property2": "yeah" + } + }, + "issue-12725": { + "channel": { + "handlers": [ + { + "name": "stream", + "level": "debug", + "fingersCrossed": "info", + "filename": "channel.log" + }, + { + "name": "redis", + "level": "debug", + "fingersCrossed": "info" + } + ] + } + } +} \ No newline at end of file diff --git a/tests/_data/config/config.php b/tests/_data/config/config.php index 9a8423abf1f..000314dc65e 100644 --- a/tests/_data/config/config.php +++ b/tests/_data/config/config.php @@ -1,23 +1,40 @@ array( +return [ + "phalcon" => [ "baseuri" => "/phalcon/" - ), - "models" => array( + ], + "models" => [ "metadata" => "memory" - ), - "database" => array( + ], + "database" => [ "adapter" => "mysql", "host" => "localhost", "username" => "user", "password" => "passwd", "name" => "demo" - ), - "test" => array( - "parent" => array( + ], + "test" => [ + "parent" => [ "property" => 1, "property2" => "yeah" - ), - ) - ); + ], + ], + 'issue-12725' => [ + 'channel' => [ + 'handlers' => [ + 0 => [ + 'name' => 'stream', + 'level' => 'debug', + 'fingersCrossed' => 'info', + 'filename' => 'channel.log' + ], + 1 => [ + 'name' => 'redis', + 'level' => 'debug', + 'fingersCrossed' => 'info' + ] + ] + ] + ] + ]; diff --git a/tests/_data/config/config.yml b/tests/_data/config/config.yml index 1ecf03bb747..ee22c15da45 100644 --- a/tests/_data/config/config.yml +++ b/tests/_data/config/config.yml @@ -12,3 +12,15 @@ test: parent: property: 1 property2: yeah +issue-12725: + channel: + handlers: + 0: + name: stream + level: debug + fingersCrossed: info + filename: channel.log + 1: + name: redis + level: debug + fingersCrossed: info \ No newline at end of file diff --git a/tests/unit/Config/Helper/ConfigBase.php b/tests/unit/Config/Helper/ConfigBase.php index 15c35e9d883..91115e678ed 100644 --- a/tests/unit/Config/Helper/ConfigBase.php +++ b/tests/unit/Config/Helper/ConfigBase.php @@ -43,6 +43,23 @@ class ConfigBase extends UnitTest 'property2' => 'yeah' ], ], + 'issue-12725' => [ + 'channel' => [ + 'handlers' => [ + 0 => [ + 'name' => 'stream', + 'level' => 'debug', + 'fingersCrossed' => 'info', + 'filename' => 'channel.log' + ], + 1 => [ + 'name' => 'redis', + 'level' => 'debug', + 'fingersCrossed' => 'info' + ] + ] + ] + ] ]; protected function compareConfig(array $actual, Config $expected)