Skip to content

[DependencyInjection] fix dump xml with array/object/enum default value #51307

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 14, 2023

Conversation

Jean-Beru
Copy link
Contributor

@Jean-Beru Jean-Beru commented Aug 8, 2023

Q A
Branch? 5.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets Fix #48178
License MIT
Doc PR

This PR fixes #48178 when attempting to dump the container in these conditions:

  • The constructor has in its arguments a non-empty array, an object or an enum with a default value
  • A second argument is placed after
  • A third argument is placed after and is using configuration

Example (might be more explicit):

class Foo
{
    public function __construct(
        array $array = ['a', 'b', 'c'],
        bool $firstOptional = false,
        bool $secondOptional = false
    ) {}
}
services:
    Foo:
        arguments:
            secondOptional: true

⚠️ This PR might cause Git conflicts in 6.3 and 6.4 versions. Do I have to create a dedicated PR for these versions ?

@Jean-Beru Jean-Beru requested a review from dunglas as a code owner August 8, 2023 09:03
@carsonbot carsonbot added this to the 5.4 milestone Aug 8, 2023
@Jean-Beru Jean-Beru changed the title fix(di): dump xml with array/object/enum default value [DependencyInjection] fix dump xml with array/object/enum default value Aug 8, 2023
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.

I guess this issue also exists with yaml? Can you please add a test case for it also?

@nicolas-grekas
Copy link
Member

Thank you @Jean-Beru.

@nicolas-grekas nicolas-grekas force-pushed the di/48178-fix-xml-dump-5.4 branch from a1744dd to ddc699a Compare August 14, 2023 10:47
@nicolas-grekas nicolas-grekas merged commit 997b97b into symfony:5.4 Aug 14, 2023
This was referenced Aug 26, 2023
@Jean-Beru Jean-Beru deleted the di/48178-fix-xml-dump-5.4 branch June 5, 2024 08:15
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