From 6d1377838b5e440468cb96a33a1dbf94f5941896 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Mon, 18 Jun 2012 15:34:08 +0200 Subject: [PATCH] Handle weird chars in cache keys --- src/Composer/Cache.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Composer/Cache.php b/src/Composer/Cache.php index 492a94edd..837406290 100644 --- a/src/Composer/Cache.php +++ b/src/Composer/Cache.php @@ -44,6 +44,7 @@ class Cache public function read($file) { + $file = preg_replace('{[^a-z0-9.]}i', '-', $file); if ($this->enabled && file_exists($this->root . $file)) { return file_get_contents($this->root . $file); } @@ -52,12 +53,14 @@ class Cache public function write($file, $contents) { if ($this->enabled) { + $file = preg_replace('{[^a-z0-9.]}i', '-', $file); file_put_contents($this->root . $file, $contents); } } public function sha1($file) { + $file = preg_replace('{[^a-z0-9.]}i', '-', $file); if ($this->enabled && file_exists($this->root . $file)) { return sha1_file($this->root . $file); }