Closed
Description
Q | A |
---|---|
Bug report? | no |
Feature request? | yes |
BC Break report? | no |
RFC? | no |
Symfony version | 3.2 |
Related to #20434, if you try to pull data such as CACHE from an environment variable and pass it to Twig, Twig's Bundle reads the type literally, as "false" or "true" - as it is passed from getenv
.
How to Replicate
Add this environment variable:
CACHE false
In config.yml:
twig:
cache: %env(CACHE)%
This results in a cache being created under web/false/
, which is certainly not the intended result.
Note that this has other unintended consequences throughout Symfony, where a boolean is expected but not validated.
Solutions?
A simple solution could be to use the env()
library created by Laravel as it provides for type coercion out of the box.