Thanks to visit codestin.com
Credit goes to github.com

Skip to content

PHP warning when using %env(default::FOO)% #32853

Closed
@BenMorel

Description

@BenMorel

Symfony version(s) affected: 4.3.3

Description

When using the %env(default::FOO)% environment variable processor to get the value or NULL, the app fails with a PHP warning:

Warning: array_key_exists() expects parameter 2 to be array, null given

The bug only happens when the env var is not defined, and only the first time you load a page; after that, it works and the parameter is correctly set to null when the env var is not set.

Running cache:clear does trigger the bug every time, though.

How to reproduce

  • create a new project: symfony new bug && cd bug
  • edit config/services.yaml and add the following:
    parameters:
        app.foo: '%env(default::APP_FOO)%'
  • run bin/console cache:clear

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