Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0017be5

Browse files
committed
[FrameworkBundle] Fixed cache clear command with relative file refs
1 parent 0a09eaf commit 0017be5

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
@@ -150,10 +150,10 @@ protected function warmup($warmupDir, $realCacheDir, $enableOptionalWarmers = tr
150150
}
151151

152152
// fix references to cached files with the real cache directory name
153-
$search = array($warmupDir, str_replace('\\', '\\\\', $warmupDir));
154-
$replace = str_replace('\\', '/', $realCacheDir);
153+
$search = sprintf('/(dirname\(.+?)(%s)/', preg_quote(basename($warmupDir)));
154+
$replace = sprintf('$1%s', preg_quote(basename($realCacheDir)));
155155
foreach (Finder::create()->files()->in($warmupDir) as $file) {
156-
$content = str_replace($search, $replace, file_get_contents($file));
156+
$content = preg_replace($search, $replace, file_get_contents($file));
157157
file_put_contents($file, $content);
158158
}
159159

0 commit comments

Comments
 (0)