[BUG] merge published config with package config #1873
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There is currently a bug on the way the configs are merged. If a "nested array key" is missing on the published config file,
array_merge()
wouldn't add that key and the application will fail to properly boot the config.I got the following error after updating from v8 to v9 -
Undefined array key "compression_method"
.I dug a bit on it, and indeed my published
backup.php
config file didn't had that key, but that key is present on the package config file:laravel-backup/config/backup.php
Line 133 in fe980ce
This PR changes
array_merge
toarray_replace_recursive
, so that we use the package config as the base, and replace any values from the published config file.I've added tests for both scenarios (without keys present in the published config file, and with keys present in the config file).
@freekmurze any chance you can take a look at this ?
Cheers