Переглянути джерело

Avoid warnings in case cache dir is explicitly directed to /dev/null, fixes #5468

Jordi Boggiano 8 роки тому
батько
коміт
fd6455218e
1 змінених файлів з 5 додано та 0 видалено
  1. 5 0
      src/Composer/Cache.php

+ 5 - 0
src/Composer/Cache.php

@@ -44,6 +44,11 @@ class Cache
         $this->whitelist = $whitelist;
         $this->filesystem = $filesystem ?: new Filesystem();
 
+        if (preg_match('{(^|[\\\\/])(\$null|NUL|/dev/null)([\\\\/]|$)}', $cacheDir)) {
+            $this->enabled = false;
+            return;
+        }
+
         if (
             (!is_dir($this->root) && !Silencer::call('mkdir', $this->root, 0777, true))
             || !is_writable($this->root)