From 4dfa3c469e04e5db02e4840ea23a1aa6264f0f9c Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Sun, 20 Jul 2014 19:07:31 +0200 Subject: [PATCH] Fix class map generator handling of missing files --- src/Composer/Autoload/ClassMapGenerator.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Composer/Autoload/ClassMapGenerator.php b/src/Composer/Autoload/ClassMapGenerator.php index 8f45adee8..0f289bcbd 100644 --- a/src/Composer/Autoload/ClassMapGenerator.php +++ b/src/Composer/Autoload/ClassMapGenerator.php @@ -116,6 +116,14 @@ class ClassMapGenerator try { $contents = @php_strip_whitespace($path); + if (!$contents) { + if (!file_exists($path)) { + throw new \Exception('File does not exist'); + } + if (!is_readable($path)) { + throw new \Exception('File is not readable'); + } + } } catch (\Exception $e) { throw new \RuntimeException('Could not scan for classes inside '.$path.": \n".$e->getMessage(), 0, $e); }