You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
Symfony's twig-bundle is ignoring the twig.cache configuration, and still attempting to warm the cache.
How to reproduce
Change twig.cache to false and run cache:clear with symfony/twig-bundle installed.
Possible Solution
Additional context
The reason this is problematic is in my case, we are loading templates from a DB. We do not want these templates to be fetched ahead of time, as there are a ton of them (potentially thousands).
This is related to symfony/symfony-docs#10101 in which the documentation incorrectly specifies how to disable caching.
The text was updated successfully, but these errors were encountered:
I've since discovered this only occurs when you have a custom loader in your application. The second you have a class that implements Twig\Loader\LoaderInterface, the issue occurs.
I tested a fresh symfony 4 application and required twig-bundle. Before clearing the cache, the twig directory was there. After adding cache: false to twig.yaml, clearing the cache (rm -rf var/cache/dev) and then rerunning composer run post-update-cmd, the twig directory is no longer there.
However, as soon as I created my TestLoader, the exists() method was being called during this process. I know since I added an exception to it, as it shouldn't have been called.
Edit: I was able to fix my issue without disabling cache by changing the priority on the custom loader to -1. However, this bug still stands because if cache is false, then the loader should never have been called to begin with.
Symfony version(s) affected: 4.1.1
Description
Symfony's twig-bundle is ignoring the
twig.cache
configuration, and still attempting to warm the cache.How to reproduce
Change
twig.cache
tofalse
and runcache:clear
withsymfony/twig-bundle
installed.Possible Solution
Additional context
The reason this is problematic is in my case, we are loading templates from a DB. We do not want these templates to be fetched ahead of time, as there are a ton of them (potentially thousands).
This is related to symfony/symfony-docs#10101 in which the documentation incorrectly specifies how to disable caching.
The text was updated successfully, but these errors were encountered: