8000 bug #24971 [FrameworkBundle] Empty event dispatcher earlier in CacheC… · symfony/symfony@3398c4b · GitHub
[go: up one dir, main page]

Skip to content

Commit 3398c4b

Browse files
bug #24971 [FrameworkBundle] Empty event dispatcher earlier in CacheClearCommand (nicolas-grekas)
This PR was merged into the 3.4 branch. Discussion ---------- [FrameworkBundle] Empty event dispatcher earlier in CacheClearCommand | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Once the cache folder is emptied, the event dispatcher cannot be used because service factories are gone. This currently fails very badly when an error is dispatched, but the error listeners are themselves failing to be loaded for this reason. Commits ------- a961392 [FrameworkBundle] Empty event dispatcher earlier in CacheClearCommand
2 parents e70c1f8 + a961392 commit 3398c4b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
111111
$io->comment(sprintf('Clearing the cache for the <info>%s</info> environment with debug <info>%s</info>', $kernel->getEnvironment(), var_export($kernel->isDebug(), true)));
112112
$this->cacheClearer->clear($realCacheDir);
113113

114+
// The current event dispatcher is stale, let's not use it anymore
115+
$this->getApplication()->setDispatcher(new EventDispatcher());
116+
114117
if ($input->getOption('no-warmup')) {
115118
$this->filesystem->rename($realCacheDir, $oldCacheDir);
116119
} else {
@@ -129,9 +132,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
129132

130133
$this->filesystem->remove($oldCacheDir);
131134

132-
// The current event dispatcher is stale, let's not use it anymore
133-
$this->getApplication()->setDispatcher(new EventDispatcher());
134-
135135
if ($output->isVerbose()) {
136136
$io->comment('Finished');
137137
}

0 commit comments

Comments
 (0)
0