-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Description
Symfony version(s) affected: 5.2.0
Description
A second invocation of bin/console cache:clear removes directories from the cache directory that have been created by the first invocation. For certain vendors (such as JMS Serializer and Vich Uploader), this results in a full application breakdown, as they require the directory to exist.
This also means that a third invocation of the cache:clear results in an exception for my application, as the JMS serializer checks for the directory existence during container startup.
The files I'm "missing" after the second invocation are:
annotation.phpApp_KernelDevDebugContainer.xmlApp_KernelDevDebugContainer.xml.metadoctrinejms_serializerpoolsserialization.phptranslationstwigvalidation.phpvich_uploaderwebpack_encore.cache.php
How to reproduce
You should be able to investigate the behavior with a standard Symfony installation with Twig, as that is also one of the removed folders. However, it won't throw an error in that scenario, as Twig just recreates the required folders.
It looks like the second invocation doesn't execute the warmup stage, but running the cache:warmup command doesn't help here due to the vendor missing the required folder.
Possible Solution
I'm not sure whether this is something that is broken within Symfony, or that the vendors should be making adjustments to be more robust for missing cache folders/missing warmup. However, IMO this is a massive difference between 5.1 and 5.2, so I believe that if this was intentional, it should be postponed to 6.0.