From 7ed1d588916d103cdbac0fdca985e4068291b658 Mon Sep 17 00:00:00 2001 From: Philippe Le Brouster Date: Mon, 8 Aug 2016 12:16:56 +0200 Subject: [PATCH] Fix filterDump failure on base64 encoded image The content of a css url directive could be a base64 encoded image. The length of the string can be long. ( >4096). On some plateforms the filename length is limited to less than 4096. In this case the fonction filterDump fails because of using `file_exists` (in checkPath) on string longer than 4096. To prevent this, you need to check if the url directive begins with "data:" --- Assetic/Filter/CssURLRewriteFilter.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Assetic/Filter/CssURLRewriteFilter.php b/Assetic/Filter/CssURLRewriteFilter.php index 7ea6f74..abe44c8 100644 --- a/Assetic/Filter/CssURLRewriteFilter.php +++ b/Assetic/Filter/CssURLRewriteFilter.php @@ -41,6 +41,8 @@ public function filterDump(AssetInterface $asset) $tmpPath = $that->checkForBundleLinking($matches[3]); if ($tmpPath != null) { return $matches[1].'('.$matches[2].$tmpPath.')'; + } elseif (substr($matches[3],0,5) == "data:") { + return $matches[1].'('.$matches[2].$matches[3].')'; } elseif (!$that->checkPath($matches[3])) { return $matches[1].'('.$matches[2].$matches[3].')'; }