diff --git a/CHANGELOG.md b/CHANGELOG.md index c292e2b31..733de9b7e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ### [2.2.15] 2022-07-01 + * Fixed support for read-only caches where the filesystem is not writable (#10906) * Fixed type error when using `allow-plugins: true` (#10909) * Fixed @putenv scripts receiving arguments passed to the command (#10846) * Fixed support for spaces in paths with binary proxies on Windows (#10836) diff --git a/src/Composer/Cache.php b/src/Composer/Cache.php index c7da5c612..1390e09b1 100644 --- a/src/Composer/Cache.php +++ b/src/Composer/Cache.php @@ -98,8 +98,11 @@ class Cache $this->enabled = true; if ( - (!is_dir($this->root) && !Silencer::call('mkdir', $this->root, 0777, true)) - || !is_writable($this->root) + !$this->readOnly + && ( + (!is_dir($this->root) && !Silencer::call('mkdir', $this->root, 0777, true)) + || !is_writable($this->root) + ) ) { $this->io->writeError('Cannot create cache directory ' . $this->root . ', or directory is not writable. Proceeding without cache'); $this->enabled = false;