bug #34301 [DI] fix loading env while env loaders are loaded (nicolas-grekas)
This PR was merged into the 4.4 branch.
Discussion
----------
[DI] fix loading env while env loaders are loaded
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
Commits
-------
522bd5d99d
[DI] fix loading env while env loaders are loaded
This commit is contained in:
commit
26f25ab2b5
|
@ -141,15 +141,20 @@ class EnvVarProcessor implements EnvVarProcessorInterface
|
|||
}
|
||||
}
|
||||
|
||||
$loaders = $this->loaders;
|
||||
$this->loaders = new \ArrayIterator();
|
||||
|
||||
try {
|
||||
while ((false === $env || null === $env) && $this->loaders->valid()) {
|
||||
$loader = $this->loaders->current();
|
||||
$this->loaders->next();
|
||||
while ((false === $env || null === $env) && $loaders->valid()) {
|
||||
$loader = $loaders->current();
|
||||
$loaders->next();
|
||||
$this->loadedVars[] = $vars = $loader->loadEnvVars();
|
||||
$env = $vars[$name] ?? false;
|
||||
}
|
||||
} catch (ParameterCircularReferenceException $e) {
|
||||
// skip loaders that need an env var that is not defined
|
||||
} finally {
|
||||
$this->loaders = $loaders;
|
||||
}
|
||||
|
||||
if (false === $env || null === $env) {
|
||||
|
|
Reference in New Issue