Skip to content

Parse environment variable into array #40906

@Nyholm

Description

@Nyholm

Symfony version(s) affected: 5.2.6

Description
I cannot parse an environment variable into an array.

How to reproduce

# env
TRUSTED_HOSTS="[\"10.0.0.1\", \"10.0.0.2\"]"
# config/packages/framework.yaml
framework:
    trusted_hosts: '%env(json:TRUSTED_HOSTS)%'

I get:

Invalid type for path “framework.trusted_hosts.0”. Expected one of “bool”, “int”, “float”, “string”, but got “array”.

See reproducer repo: https://github.com/Nyholm/sf-issue-40906

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