-
Notifications
You must be signed in to change notification settings - Fork 11.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changed environment config loading from array_merge() to array_replace_recursive() #1225
Changed environment config loading from array_merge() to array_replace_recursive() #1225
Conversation
This is not the desired behavior and actually breaks config loading. |
Err, thought you said array_merge_recursive. Sorry, will look at this later. |
Yes. array_merge_recursive() would break things. Here's a blog post illustrating the difference. http://jontai.me/blog/2011/12/array_merge_recursive-vs-array_replace_recursive/ |
This is the exact same pull as #757 FYI @taylorotwell |
Having said that, I kinda like it and I do use it in my composite config package (which cascades config from the database). |
Dang! I even searched for a previous pull request. |
Yeah this seems to work well. I must have been making the same mistake in the previous pull request. |
…-merging-recursively Changed environment config loading from array_merge() to array_replace_recursive()
Add <?php as the first line of your app/config/local/database.php and that should fix it. |
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.
Small change when loading environment specific configurations. Now the code below will merge the username/password into database connections array instead of replacing it entirely.