Commit 5cf2616
committed
bug #62558 [DependencyInjection] Don't add empty
This PR was merged into the 7.4 branch.
Discussion
----------
[DependencyInjection] Don't add empty `.container.known_envs` in XML loader
| Q | A
| ------------- | ---
| Branch? | 7.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Issues | -
| License | MIT
The XML loader is the only one that creates the `.container.known_envs` parameter even if there is no `<when env="...">` in the file. The PHP and Yaml loaders read and update this parameter only when they find a `when@<env>` key.
https://github.com/symfony/symfony/blob/1aa580f49841d479754c34102e42d334d0ce1a5a/src/Symfony/Component/DependencyInjection/Loader/PhpFileLoader.php#L81-L85
https://github.com/symfony/symfony/blob/1aa580f49841d479754c34102e42d334d0ce1a5a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php#L958-L962
This is causing an issue in [symfony-config-xml-to-php](https://github.com/GromNaN/symfony-config-xml-to-php) when comparing the result of loading equivalent PHP and XML config files. This key is added by the XML loader, not the PHP loader.
Commits
-------
c3fa63b [DependencyInjection] Don't add the .container.known_envs parameter when empty.container.known_envs in XML loader (GromNaN)File tree
2 files changed
+2
-5
lines changed- src/Symfony/Component/DependencyInjection
- Loader
- Tests/Loader
2 files changed
+2
-5
lines changedLines changed: 2 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
67 | 66 | | |
68 | | - | |
| 67 | + | |
| 68 | + | |
69 | 69 | | |
70 | | - | |
71 | 70 | | |
72 | 71 | | |
73 | 72 | | |
| |||
Lines changed: 0 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
157 | | - | |
158 | 157 | | |
159 | 158 | | |
160 | 159 | | |
| |||
191 | 190 | | |
192 | 191 | | |
193 | 192 | | |
194 | | - | |
195 | 193 | | |
196 | 194 | | |
197 | 195 | | |
| |||
0 commit comments