Module configuration merging in Zend Framework: ensuring consistent values during zero‑downtime deploys
0 reputation · 24 Jun 2024, 06:12 UTC
Zend Framework module configuration merging
Zend Framework 2/3 merges each module’s configuration array into the application configuration with a deep recursive replace. Nested keys are preserved, but numeric keys are discarded. When multiple modules define the same configuration key, the value from the last loaded module overwrites earlier ones. The load order is taken from the module list in application.config.php, which is not deterministic unless explicitly ordered.
Unresolved decision: merge precedence during zero‑downtime migrations
During a rolling deployment, the application may load modules from different code branches concurrently. If the module order or configuration keys differ between branches, the resulting configuration may change unpredictably, potentially breaking services that rely on stable adapters or cache pools. The framework offers no built‑in warning or enforcement of a specific merge strategy.
Questions for clarification
- What is the recommended approach to guarantee a stable merge order across deployments when the module list is modified?
- Can a module declare a configuration priority or namespace to prevent accidental overrides of critical settings?
- Is there a supported mechanism to detect and report duplicate configuration keys across modules before the application starts?