-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DependencyInjection] Stop considering empty env vars as populated #48705
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
06668f7
to
9690fb8
Compare
9690fb8
to
a8f8903
Compare
PR rebased on 6.3 |
Thank you @nicolas-grekas. |
Just a question on this. Prior to 6.3 it was common to have things like
in the return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->extension(
'sentry',
[
'dsn' => env('SENTRY_DSN'),
]
);
}; or in the
Is it the intention of this PR to introduce a b/c break where this would work in 6.2, but after upgrading to Symfony 6.3, this would now throw an If it was your intention for this to not be backward compatible, then cool - it worked :) Just trying to work out if it's on purpose or a bug introduced. |
Did you experience this exception or are you just wondering? If you're wondering, can you give it a try? |
I've experienced it on multiple projects upgrading to 6.3.x-dev sorry Will dig deeper tomorrow and find a minimal reproducer for you |
As promised, a scaled down reproducer is detailed here for you #50094 |
…:list (nicolas-grekas) This PR was merged into the 6.3 branch. Discussion ---------- [FrameworkBundle] Ignore vars from dotenv files in secrets:list | Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Sidekick of #48705 Commits ------- 8561045 [FrameworkBundle] Ignore vars from dotenv files in secrets:list
…vars (Okhoshi) This PR was merged into the 6.3 branch. Discussion ---------- [DependencyInjection] Fix support for `false` boolean env vars | Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - After upgrading `symfony/dependency-injection` package to version 6.3, some of our env vars couldn't be found anymore. For some scripts, we are providing an adhoc default value to env vars by setting `$_SERVER` directly. However, since version 6.3 of the DependencyInjection component, setting an env var to `false` (the boolean value, like in the snippet below) doesn't work anymore, and Symfony reports that the variable cannot be found. ```php $_SERVER['FOO'] = false; ``` It seems to be a side effect of the changes made in #48705. Commits ------- 5101d18 [DependencyInjection] Fix support for `false` boolean env vars
When a
.env
file declares an empty var (egFOO=
), env-var loaders are skipped.This is a foot gun that has hit me many times when using secrets and that I consider a DX bug.
This PR fixes the issue by ensuring that env vars defined as empty strings don't prevent loaders from being called.