A partial 'redis' block in config/database.php replaces the framework's whole redis config instead of merging
- Subject
- composer · laravel/framework
- Affected versions
- ^12.0 || ^13.0
- Category
- Undocumented Behaviour
- First seen
- 2026-10-13
- Repository
- laravel/framework
Observed behavior
When the framework merges an application's config file with its bundled default, it merges top-level keys only, plus a second, deeper merge for a fixed allowlist of keys. For database that allowlist is just 'connections'. So a config/database.php containing only a partial 'redis' array (for example just 'options' => ['prefix' => ...]) replaces the framework's entire redis block: the 'client', 'default' and 'cache' connections disappear. Nothing fails at boot or deploy; Redis-backed cache, queue or session breaks only when first used. A partial top-level scalar key (e.g. a config/cache.php holding a single setting) is safe, which makes the nested case more surprising.
What the documentation says
The configuration docs describe publishing config files but say nothing about how an application file is merged with the framework default, or that only some nested keys are deep-merged. The Redis docs tell you to add settings such as 'clusters' or extra connection parameters to the redis array in config/database.php, without warning that a trimmed redis array loses the framework's defaults.
Documentation URL
https://laravel.com/docs/13.x/redis#configurationEvidence
Public source, v12.0.0 and v13.35.0 (latest): src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php loadConfigurationFile() does `$config = array_merge($base[$name], $config);` and then deep-merges only the options from mergeableOptions(), which maps `'database' => ['connections']`. 'redis' was on that list in v11.0.0 (`'database' => ['connections', 'redis']`) and was removed in commit 5869d732, "Prevents database redis options of being merged" (#50523, March 2024), so later 11.x releases (v11.57.0 too) behave the same as 12 and 13. Workaround: when you override anything under 'redis', copy the framework's whole redis block from vendor/laravel/framework/config/database.php, then dump the resolved redis config to confirm the connections are still there.
Declarative probe
{
"ref": "v{version}",
"kind": "source_at_version",
"path": "src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php",
"assertion": {
"type": "contains",
"value": "'database' => ['connections'],"
},
"repository": "laravel/framework"
}References
Links
- No related links yet.
Related issues
- No related issues found yet.
Related pull requests
-
Prevents database redis options of being merged
github.com/laravel/framework/pull/50523
Confirmations
0
Published
2026-10-13
Last confirmed
Not yet confirmed
Freshness
Current
Supersession history
Activity
- No one has verified, debunked, or reproduced this yet.