Skip to content

Commit 5e7e0ff

Browse files
committed
Fixing cascade behaviour for package config.
Normal configs were cascading with array_replace_recursive(), which merged recursive arrays nicely, however Package configs were using array_merge(), which only merged the top-level arrays. This is inconsistent across the configuration handling, and is confusing for users trying to override specific package configuration. It looks like this fix was proposed in Issue laravel#757, but missed when the Issue laravel#1225 was proposed, considered a duplicate, and eventually merged.
1 parent dbe372d commit 5e7e0ff

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Illuminate/Config/FileLoader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ public function cascadePackage($env, $package, $group, $items)
159159

160160
if ($this->files->exists($path = $this->defaultPath.'/'.$file))
161161
{
162-
$items = array_merge($items, $this->getRequire($path));
162+
$items = array_replace_recursive($items, $this->getRequire($path));
163163
}
164164

165165
// Once we have merged the regular package configuration we need to look for
@@ -169,7 +169,7 @@ public function cascadePackage($env, $package, $group, $items)
169169

170170
if ($this->files->exists($path))
171171
{
172-
$items = array_merge($items, $this->getRequire($path));
172+
$items = array_replace_recursive($items, $this->getRequire($path));
173173
}
174174

175175
return $items;

0 commit comments

Comments
 (0)