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

Skip to content

[DI] Fix EnvVar not loaded when Loader requires an env var #35355

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

Merged
merged 1 commit into from
Jan 20, 2020

Conversation

jderusse
Copy link
Member

Q A
Branch? 4.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets #35348
License MIT
Doc PR NA

When an EnvVarLoader has a dependency on an Env Var tried to be loaded (which is the case for SodiumVault that is configured with default::SYMFONY_DECRYPTION_SECRET) the Loader is not usable.

What happens:

  • when trying to resolve SYMFONY_DECRYPTION_SECRET, the EnvVarProcessor iterates over loaders
  • given SodiumVaultLoaders requires the same env variable SYMFONY_DECRYPTION_SECRET, it throws a ParameterCircularReferenceException
  • letting the $loaders generator invalid

This PR, refactor the way loaders are iterated in order to rewind on failure.

Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, with some comments. Please add tests :)

@jderusse jderusse force-pushed the fix-cirtuclar-loader branch 2 times, most recently from cc1849a to 85d2f05 Compare January 17, 2020 11:58
@nicolas-grekas nicolas-grekas changed the title [DependencyInjection] Fix EnvVar not loaded when Loader requires an env var [DI] Fix EnvVar not loaded when Loader requires an env var Jan 20, 2020
Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not easy, but patch is good!
(I did some minor changes + improved tests while reviewing)

@nicolas-grekas
Copy link
Member

Good catch, thanks @jderusse.

nicolas-grekas added a commit that referenced this pull request Jan 20, 2020
… (jderusse)

This PR was merged into the 4.4 branch.

Discussion
----------

[DI] Fix EnvVar not loaded when Loader requires an env var

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | #35348
| License       | MIT
| Doc PR        | NA

When an EnvVarLoader has a dependency on an Env Var tried to be loaded (which is the case for SodiumVault that is configured with `default::SYMFONY_DECRYPTION_SECRET`) the Loader is not usable.

What happens:
- when trying to resolve `SYMFONY_DECRYPTION_SECRET`, the EnvVarProcessor iterates over loaders
- given SodiumVaultLoaders requires the same env variable `SYMFONY_DECRYPTION_SECRET`, it throws a `ParameterCircularReferenceException`
- letting the $loaders generator invalid

This PR, refactor the way loaders are iterated in order to rewind on failure.

Commits
-------

e119aa6 [DI] Fix EnvVar not loaded when Loader requires an env var
@nicolas-grekas nicolas-grekas merged commit e119aa6 into symfony:4.4 Jan 20, 2020
@jderusse jderusse deleted the fix-cirtuclar-loader branch January 20, 2020 12:21
This was referenced Jan 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants