Skip to content

[6.3] blank env vars - Environment variable not found #50094

@PhilETaylor

Description

@PhilETaylor

Symfony version(s) affected

6.3.x-dev

Description

as per conversation with @nicolas-grekas here #48705 (comment) and possibly related to #48705

Using the reproducer, which has a .env with MY_EXAMPLE_ENV= when clearing cache (clearing cache in enough in the reproducer to reproduce the issue, but in a live app loading any webpage also crashes with same message)

Note the reproducer is creating a parameter from the env var and then twig is consuming that parameter to create global variables.

IT IS THIS CONSUMPTION by twig that generates the issue, without /config/twig.php trying to set a global from the parameter, the problem doesn't happen

ScreenShot-2023-04-21-12 59 14

How to reproduce

Here is a reproducer

This was created with

  • composer create-project symfony/skeleton bug_app_env
  • cd bug_app_env
  • change composer.json to be 6.3
  • composer req twig
  • add config/example.php to create a parameter
  • add config/twig.php to consume that parameter

to replicate the bug then run php bin/console cache:clear

Possible Solution

No response

Additional Context

to be clear, debug:dotenv correctly loads and gives

ScreenShot-2023-04-21-13 04 21

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