Skip to content
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

problem with new translation component config in BETA2 #38615

Closed
craigh opened this issue Oct 17, 2020 · 1 comment
Closed

problem with new translation component config in BETA2 #38615

craigh opened this issue Oct 17, 2020 · 1 comment

Comments

@craigh
Copy link

craigh commented Oct 17, 2020

Symfony version(s) affected: 5.2.0-BETA2

Description
new php configuration changes the #3 argument from

        <argument type="collection" /> <!-- translation loaders ids -->

to

            abstract_arg('translation loaders ids'),

This causes problems with (at least) willdurand/BazingaJsTranslationBundle because they use a compiler pass that pulls the #3 argument and assumes it is an array then uses array_merge() with that arg.

How to reproduce
What I did was upgrade my working project from symfony 5.1.x to 5.2.0-BETA2 and ran my tests. It fails for the reason above. I know this is not a very reproducible bug and I don't have a better idea to made it reproducible.

Possible Solution
could \Symfony\Component\DependencyInjection\Argument\AbstractArgument be made iterable? not sure that would solve the problem though. Mabe have the default arg be an empty array instead? I don't know what the old collection argument type default value is.

refs willdurand/BazingaJsTranslationBundle#291

@craigh craigh added the Bug label Oct 17, 2020
@derrabus derrabus added this to the 5.2 milestone Oct 17, 2020
@craigh
Copy link
Author

craigh commented Oct 17, 2020

I'm sure it would be incorrect to do so, but for argument sake, if I change

        ->args([
            abstract_arg('translation loaders locator'),
            service('translator.formatter'),
            param('kernel.default_locale'),
            abstract_arg('translation loaders ids'),
            [
                'cache_dir' => param('kernel.cache_dir').'/translations',
                'debug' => param('kernel.debug'),
            ],
            abstract_arg('enabled locales'),
        ])

to this

        ->args([
            abstract_arg('translation loaders locator'),
            service('translator.formatter'),
            param('kernel.default_locale'),
            [],
            [
                'cache_dir' => param('kernel.cache_dir').'/translations',
                'debug' => param('kernel.debug'),
            ],
            abstract_arg('enabled locales'),
        ])

then it works correctly for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants