8000 [DI] Don't track merged configs when the extension doesn't expose it by nicolas-grekas · Pull Request #24021 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[DI] Don't track merged configs when the extension doesn't expose it #24021

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
Aug 31, 2017

Conversation

nicolas-grekas
Copy link
Member
Q A
Branch? 3.3
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #24020
License MIT
Doc PR -

This is driving me crazy :)

@nicolas-grekas
Copy link
Member Author

So, this happens when the DI extension doesn't call Extension::processConfiguration(), which is the case in PropelBundle (fixed in propelorm/PropelBundle#461.)

Shouldn't be common, so I wouldn't recommend a new release (yet.)

@gharlan
Copy link
Contributor
gharlan commented Aug 29, 2017

@nicolas-grekas Thanks! I can confirm:

  1. It works with your PropelBundle fix, without this pr
  2. It works with your pr without changing PropelBundle
  3. And of course, it also works with both changes together.

@nicolas-grekas nicolas-grekas changed the title [DI] Track env placeholders found in the container [DI] Don't track merged configs when the extension doesn't expose it Aug 29, 2017
Copy link
Member
@chalasr chalasr left a comment

Choose a reason for hiding this comment

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

👍 Do not deserve an immediate release to me either

@jeremyFreeAgent
Copy link
Contributor

Hi guys, thanks for the fix!

What about release that one since every bundle without the fix may have issue?

@gharlan confirms that this PR fix the issue without change in the bundles.

@nicolas-grekas
Copy link
Member Author
nicolas-grekas commented Aug 29, 2017

@jeremyFreeAgent if you have the issue (do you?), you'd better fix it in your bundle also because its current behavior will prevent correct tracking of ENV vars anyway.

@jeremyFreeAgent
Copy link
Contributor

@nicolas-grekas I was not talking about my bundle but the community bundles. I mean okay we can PR every bundle we spot with that issue but what about basic users of Symfony that will only update Symfony and expect everything still works?

BTW I have PR the fix in symfonycorp/connect-bundle#17 and It was merged :)

@samvdb
Copy link
samvdb commented Aug 30, 2017

I can confirm the same bug using 8p/guzzle-bundle.

@nicolas-grekas
Copy link
Member Author

@samvdb can you submit a PR on https://github.com/8p/GuzzleBundle/blob/master/DependencyInjection/GuzzleExtension.php to fix that extension the same way as done in symfonycorp/connect-bundle#17?

@nicolas-grekas
Copy link
Member Author
nicolas-grekas commented Aug 30, 2017

BTW, I'll propose to deprecate not calling Extension::processConfiguration() in 3.4, and throw an exception in 4.0

8000

@samvdb
Copy link
samvdb commented Aug 30, 2017

@nicolas-grekas PR is open, can confirm this fixes the issue.
8p/EightPointsGuzzleBundle#120

@stof
Copy link
Member
stof commented Aug 30, 2017

@nicolas-grekas could we detect that this method was not called, and use the previous behavior for replacing env placeholders in this case ? This would not solve the shadowing of the config in case a variable is not used anymore in the end. But it would mean that the contain keeps working when the config is now shadowed.
Otherwise, it means we broke BC in a patch version.

@nicolas-grekas
Copy link
Member Author

@stof see patch, that should be what L97 does.

// serialize config to catch env vars nested in object graphs
$config = serialize($extension->getProcessedConfigs());
// serialize config and container to catch env vars nested in object graphs
$config = serialize($config).serialize($container->getDefinitions()).serialize($container->getAliases()).serialize($container->getParameterBag()->all());
Copy link
Member

Choose a reason for hiding this comment

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

aliases don't need to be serialized. They only have a target and a public flag, and these cannot use parameters.

Copy link
Member Author

Choose a reason for hiding this comment

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

@fabpot
Copy link
Member
fabpot commented Aug 31, 2017

Thank you @nicolas-grekas.

@fabpot fabpot merged commit a8e6aac into symfony:3.3 Aug 31, 2017
fabpot added a commit that referenced this pull request Aug 31, 2017
… expose it (nicolas-grekas)

This PR was merged into the 3.3 branch.

Discussion
----------

[DI] Don't track merged configs when the extension doesn't expose it

| Q             | A
| ------------- | ---
| Branch?       | 3.3
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #24020
| License       | MIT
| Doc PR        | -

This is driving me crazy :)

Commits
-------

a8e6aac [DI] Don't track merged configs when the extension doesn't expose it
@nicolas-grekas nicolas-grekas deleted the di-config-ser branch September 1, 2017 06:57
@fabpot fabpot mentioned this pull request Sep 11, 2017
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.

8 participants
0