Skip to content

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

@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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy