diff --git a/.gitignore b/.gitignore index 28bd844..5c319eb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ composer.lock +tests/cache vendor/ composer.phar .DS_Store diff --git a/src/CodeManipulation.php b/src/CodeManipulation.php index 6f07094..96d9b3e 100644 --- a/src/CodeManipulation.php +++ b/src/CodeManipulation.php @@ -63,7 +63,12 @@ function getCachedPath($file) if (State::$cacheIndexFile === null) { $indexPath = Config\getCachePath() . '/index.csv'; if (file_exists($indexPath)) { - $table = array_map('str_getcsv', file($indexPath)); + $table = array_map( + static function($line) { + return str_getcsv($line, ',', '"', '\\'); + }, + file($indexPath) + ); foreach ($table as $row) { list($key, $value) = $row; State::$cacheIndex[$key] = $value; diff --git a/tests/get-cached-path.phpt b/tests/get-cached-path.phpt new file mode 100644 index 0000000..ab08cf6 --- /dev/null +++ b/tests/get-cached-path.phpt @@ -0,0 +1,48 @@ +--TEST-- +Test getCachedPath function (https://github.com/antecedent/patchwork/pull/170) + +--FILE-- + + +--CLEAN-- + +--EXPECT-- +PASS +PASS