diff --git a/Assetic/Filter/CssURLRewriteFilter.php b/Assetic/Filter/CssURLRewriteFilter.php index 0a8725e..d7bb475 100644 --- a/Assetic/Filter/CssURLRewriteFilter.php +++ b/Assetic/Filter/CssURLRewriteFilter.php @@ -113,7 +113,18 @@ private function calculateSwitchPath() if (substr($targetPath, 0, 11) == '_controller') { try { - $request = $this->kernel->getContainer()->get('request'); + $request = null; + + if ($this->container->has('request_stack')) { + + $request = $this->kernel->getContainer()->get('request_stack')->getCurrentRequest(); + + } elseif (method_exists($this->container, 'isScopeActive') && $this->container->isScopeActive('request')) { + + $request = $this->kernel->getContainer()->get('request'); + + } + if (substr($request->getBaseUrl(), -4) != '.php') { $output = substr($output, 3); }