From fd6455218e304e9b484bebb0efcdb67bb52d051d Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Sat, 25 Jun 2016 15:49:52 +0100 Subject: [PATCH] Avoid warnings in case cache dir is explicitly directed to /dev/null, fixes #5468 --- src/Composer/Cache.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Composer/Cache.php b/src/Composer/Cache.php index a6044b630..4b1648841 100644 --- a/src/Composer/Cache.php +++ b/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)