From 00d79d559daac06e5fcd508e902546cd7e3076ad Mon Sep 17 00:00:00 2001 From: Rafael Dohms Date: Mon, 25 Nov 2013 11:32:15 +0100 Subject: [PATCH] Adjusting CacheClear Warmup method to namespaced kernels Backported the patch in #9525 to the 2.3 branch. --- .../Bundle/FrameworkBundle/Command/CacheClearCommand.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php index a4ffb50eea..932f586985 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php @@ -120,10 +120,13 @@ EOF $warmer->warmUp($warmupDir); // fix references to the Kernel in .meta files + $safeTempKernel = str_replace('\\', '\\\\', get_class($tempKernel)); + $realKernelFQN = get_class($realKernel); + foreach (Finder::create()->files()->name('*.meta')->in($warmupDir) as $file) { file_put_contents($file, preg_replace( - '/(C\:\d+\:)"'.get_class($tempKernel).'"/', - sprintf('$1"%s"', $realKernelClass), + '/(C\:\d+\:)"'.$safeTempKernel.'"/', + sprintf('$1"%s"', $realKernelFQN), file_get_contents($file) )); }