Skip to content

Symfony secrets override not working in case of empty and null value #51807

Closed as not planned
@hanishsingla

Description

@hanishsingla

Symfony version(s) affected

6.3.0

Description

Secrets can be overridden by environmental variables as mentioned in https://symfony.com/doc/current/configuration/secrets.html#referencing-secrets-in-configuration-files

If you need some different values on your local machine you can also create a local secret, which will in turn update .env.{env}.local file
https://symfony.com/doc/current/configuration/secrets.html#local-secrets-overriding-secrets-locally

But since 6.3 release, this behavior is broken if you are overriding a secret value with an empty value or null

How to reproduce

  1. Create a secret value with php bin/console secrets:set DATABASE_PASSWORD
  2. Override this secret value with help of .env file, to a null or empty string value
  3. Set this secret/env to a parameter as mentioned in https://symfony.com/doc/current/configuration/secrets.html#referencing-secrets-in-configuration-files
  4. Check secret value php bin/console secrets:list --reveal
  5. Check parameter value in controller

Possible Solution

This bug is introduced by https://github.com/symfony/symfony/pull/48705/files

Additional Context

Possible link to
#50094
#50101
#48705
#50301
#50712

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