Skip to content

Commit e2067b2

Browse files
staabmondrejmirtes
authored andcommitted
Don't invalidate container cache on user-interactions in the shell
1 parent ac46a7f commit e2067b2

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

src/DependencyInjection/Configurator.php

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,20 +87,28 @@ public function loadContainer(): string
8787
$staticParameters = $this->staticParameters;
8888
ksort($staticParameters['env']);
8989
unset($staticParameters['env']['_']);
90+
// make sure variables which can get defined by the shell
91+
// after user-interactions with the UI will not invalidate the container cache
9092
unset($staticParameters['env']['SHLVL']);
93+
unset($staticParameters['env']['OLDPWD']);
94+
unset($staticParameters['env']['LINES']);
95+
unset($staticParameters['env']['COLUMNS']);
96+
unset($staticParameters['env']['SHELL_VERBOSITY']);
97+
98+
$containerKey = [
99+
$staticParameters,
100+
array_keys($this->dynamicParameters),
101+
$this->configs,
102+
PHP_VERSION_ID - PHP_RELEASE_VERSION,
103+
is_file($attributesPhp) ? hash_file('sha256', $attributesPhp) : 'attributes-missing',
104+
NeonAdapter::CACHE_KEY,
105+
$this->getAllConfigFilesHashes(),
106+
var_export(TurboExtensionEnabler::isLoaded(), true),
107+
];
91108

92109
$className = $loader->load(
93110
[$this, 'generateContainer'],
94-
[
95-
$staticParameters,
96-
array_keys($this->dynamicParameters),
97-
$this->configs,
98-
PHP_VERSION_ID - PHP_RELEASE_VERSION,
99-
is_file($attributesPhp) ? hash_file('sha256', $attributesPhp) : 'attributes-missing',
100-
NeonAdapter::CACHE_KEY,
101-
$this->getAllConfigFilesHashes(),
102-
var_export(TurboExtensionEnabler::isLoaded(), true),
103-
],
111+
$containerKey,
104112
);
105113

106114
if ($this->journalContainer) {

0 commit comments

Comments
 (0)