From 5ebf7d4dfda126b442450effaec421a106c010de Mon Sep 17 00:00:00 2001 From: Faizan Akram Date: Sun, 8 Dec 2024 10:46:43 +0100 Subject: [PATCH] fix(dependency-injection): reset env vars with kernel.reset - fixes #59128 --- Container.php | 8 ++++++++ EnvVarProcessor.php | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/Container.php b/Container.php index cd7105546..a028de7ee 100644 --- a/Container.php +++ b/Container.php @@ -290,6 +290,14 @@ public function reset(): void $this->envCache = $this->services = $this->factories = $this->privates = []; } + /** + * @internal + */ + public function resetEnvCache(): void + { + $this->envCache = []; + } + /** * Gets all service ids. * diff --git a/EnvVarProcessor.php b/EnvVarProcessor.php index 62da6e810..fe81341e6 100644 --- a/EnvVarProcessor.php +++ b/EnvVarProcessor.php @@ -374,5 +374,9 @@ public function reset(): void { $this->loadedVars = []; $this->loaders = $this->originalLoaders; + + if ($this->container instanceof Container) { + $this->container->resetEnvCache(); + } } }