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

Skip to content

Conversation

@nicolas-grekas
Copy link
Member

@nicolas-grekas nicolas-grekas commented May 30, 2025

Q A
Branch? 7.4
Bug fix? no
New feature? no
Deprecations? no
Issues -
License MIT

To unlock #60568 this uses serialize() to dump the container, next to the XML dump.

@carsonbot carsonbot added this to the 7.4 milestone May 30, 2025
@nicolas-grekas nicolas-grekas changed the title [DependencyInjection][FrameworkBundle] Use php-serialize to dump the … [DependencyInjection][FrameworkBundle] Use php-serialize to dump the container for debug/link commands May 30, 2025
@symfony symfony deleted a comment from carsonbot May 30, 2025
@nicolas-grekas nicolas-grekas force-pushed the dump-container-ser branch 4 times, most recently from 965f23d to 013e6ce Compare May 30, 2025 14:27
@nicolas-grekas nicolas-grekas force-pushed the dump-container-ser branch 2 times, most recently from e804022 to 930c4a6 Compare June 2, 2025 08:15
@nicolas-grekas nicolas-grekas changed the title [DependencyInjection][FrameworkBundle] Use php-serialize to dump the container for debug/link commands [DependencyInjection][FrameworkBundle] Use php-serialize to dump the container for debug/lint commands Jun 2, 2025
@nicolas-grekas
Copy link
Member Author

Let's merge this @symfony/mergers ?

@nicolas-grekas nicolas-grekas merged commit 7e089a5 into symfony:7.4 Jun 26, 2025
10 of 11 checks passed
@nicolas-grekas nicolas-grekas deleted the dump-container-ser branch June 27, 2025 06:09
@MatTheCat
Copy link
Contributor

@nicolas-grekas the XML dump has an issue because percent signs are not necessarily escaped and env var placeholders are reset to their %env(…)% format, which means e.g. %%env(FOO)%% and %env(FOO)% would both end up as %env(FOO)%.

Could the new dump format be the occasion to fix this issue?

@nicolas-grekas
Copy link
Member Author

Can you double-check this aspect?

@MatTheCat
Copy link
Contributor

Yes, this is what #34541 tried to solve.

@MatTheCat
Copy link
Contributor

Opened #61306

fabpot added a commit that referenced this pull request Aug 2, 2025
…inerBuilders (MatTheCat)

This PR was merged into the 7.4 branch.

Discussion
----------

[FrameworkBundle] Escape parameters when serializing ContainerBuilders

| Q             | A
| ------------- | ---
| Branch?       | 7.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Issues        | N/A
| License       | MIT

Since the `XmlDumper` didn’t escape uncompiled containers’ parameters, there was no way to differentiate a parameter placeholder from its escaped counterpart (e.g. `%%foo%%` and `%foo%` both are dumped as `%foo%`). This could make `lint:container --resolve-env-vars` fail in some cases.

This PR doesn’t change the `XmlDumper` to keep BC, but alter the way `ContainerBuilder`s are serialized by #60597 as it didn’t get released yet.

Commits
-------

8ad916f [FrameworkBundle] Escape parameters when serializing a ContainerBuilder
nicolas-grekas added a commit that referenced this pull request Aug 4, 2025
This PR was merged into the 7.4 branch.

Discussion
----------

[FrameworkBundle] fix low deps tests

| Q             | A
| ------------- | ---
| Branch?       | 7.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Issues        |
| License       | MIT

follows #61306 as the added test case requires the changes from #60597 to be present

Commits
-------

b336103 fix low deps tests
This was referenced Oct 27, 2025
nicolas-grekas added a commit that referenced this pull request Nov 22, 2025
…torArgument (yoeunes)

This PR was merged into the 7.4 branch.

Discussion
----------

[DependencyInjection] Fix wrong trait usage in ServiceLocatorArgument

| Q             | A
| ------------- | ---
| Branch?       | 7.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Issues        | -
| License       | MIT

PR #60597 introduced `ArgumentTrait` to optimize serialization.

However, `ServiceLocatorArgument` accidentally imported `ArgumentTrait` (from `Configurator`).

Commits
-------

77f86c9 [DependencyInjection] Fix wrong trait usage in ServiceLocatorArgument
nicolas-grekas added a commit that referenced this pull request Dec 4, 2025
…umping container for build/lint commands (aschempp)

This PR was squashed before being merged into the 7.4 branch.

Discussion
----------

[DependencyInjection][FrameworkBundle] fix BC break when dumping container for build/lint commands

| Q             | A
| ------------- | ---
| Branch?       | 7.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Issues        |
| License       | MIT

#60597 introduced a BC break in that it assumes the `ContainerBuilder` constructor accepts the parameter bag as its first argument. However, in our application, we have a custom version of the `ContainerBuilder`.

Since the container is already built at this state, I understand that calling `__construct()` again is just a hack to re-set the parameter bag. A direct setter function for this case should fix the issue.

PS: `Kernel::buildContainer` must always return an instance of `ContainerBuilder`, so the setter method must always be there (our class inherits from it as well).

Links:
 - Original issue: contao/contao#9058
 - Custom `ContainerBuilder` https://github.com/contao/manager-plugin/blob/main/src/Config/ContainerBuilder.php

Commits
-------

843fbca [DependencyInjection][FrameworkBundle] fix BC break when dumping container for build/lint commands
symfony-splitter pushed a commit to symfony/framework-bundle that referenced this pull request Dec 4, 2025
…umping container for build/lint commands (aschempp)

This PR was squashed before being merged into the 7.4 branch.

Discussion
----------

[DependencyInjection][FrameworkBundle] fix BC break when dumping container for build/lint commands

| Q             | A
| ------------- | ---
| Branch?       | 7.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Issues        |
| License       | MIT

symfony/symfony#60597 introduced a BC break in that it assumes the `ContainerBuilder` constructor accepts the parameter bag as its first argument. However, in our application, we have a custom version of the `ContainerBuilder`.

Since the container is already built at this state, I understand that calling `__construct()` again is just a hack to re-set the parameter bag. A direct setter function for this case should fix the issue.

PS: `Kernel::buildContainer` must always return an instance of `ContainerBuilder`, so the setter method must always be there (our class inherits from it as well).

Links:
 - Original issue: contao/contao#9058
 - Custom `ContainerBuilder` https://github.com/contao/manager-plugin/blob/main/src/Config/ContainerBuilder.php

Commits
-------

843fbca424c [DependencyInjection][FrameworkBundle] fix BC break when dumping container for build/lint commands
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