Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Environment Variables lack type - break built-in Symfony configuration #22151

Copy link
Copy link
Closed
@smcjones

Description

@smcjones
Issue body actions
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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.