dockersymfonycomposer-phpsymfony-flex

file_put_contents(/root/.composer/cache/repo/https---flex.symfony.com/): failed to open stream: Is a directory error


I build my symfony 4 application with composer install inside docker container.

Composer version 1.10.19

But i got this error.

[ErrorException] file_put_contents(/root/.composer/cache/repo/https---flex.symfony.com/): failed to open stream: Is a directory

If i run composer install 1 more time without any interruption build is succeeded.

If i delete vendor and var/cache directory on project directory error accoured again.

I tried this methods:

Some build of the same project inside different container is succeeded. My container starts with this volumes:

I search across net but got no solution. PLease help.


Solution

  • This was a bug on Flex version <1.13.4

    In latest version (as I write 1.13.4) the issue is solved.

    The problem was:

    Writing to the cache with an empty key will fail with "failed to open stream: Is a directory", so do not try to do that.

    We noticed this when cloudflare - or the backend service - responded with a "last-modified" header for our CI servers (AWS) but not for our local system. This triggered the condition to become true and it tries to write a cache file without a filename.

    That problem was solved with commit d81196c3f3b5

    Edit: as posted by @Tmb a workaround is to use: composer install --no-cache ...