Skip to content

Bug in named arguments since 5.4.17, not fixed by fix in 5.4.19 #49118

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

Closed
msteltenpool opened this issue Jan 26, 2023 · 5 comments
Closed

Bug in named arguments since 5.4.17, not fixed by fix in 5.4.19 #49118

msteltenpool opened this issue Jan 26, 2023 · 5 comments

Comments

@msteltenpool
Copy link

Symfony version(s) affected

5.4.17, 5.4.19

Description

The fix in named arguments in 5.4.17 triggered issues which 5.4.19 rectified. But seems to have not fixed all cases.

How to reproduce

services:
    _defaults:
        public: true
        bind:
            $a: 'A'

    App\Controller\IndexController:
        arguments:
            $b: 'B'

Above service configuration will trigger:

In DefinitionErrorExceptionPass.php line 54:
                                                                 
  Invalid constructor argument for service "App\Controller\IndexController": integer expected but found string "b". Check your service definition.  

Adding them both to bind or both to arguments will work (but is undesired).

Possible Solution

No response

Additional Context

No response

@nicolas-grekas
Copy link
Member

Can you please provide a small reproducing app?

@nutama
Copy link

nutama commented Jan 26, 2023

Here is an example app: https://github.com/nutama/symfony-named-arguments-issue

Issue will trigger during the composer install

It will work when rolling back to symfony/dependecy-injection:5.4.17

composer require symfony/dependency-injection:5.4.17

@nicolas-grekas
Copy link
Member

Perfect thanks, I should have a fix tomorrow!

nicolas-grekas added a commit that referenced this issue Jan 27, 2023
…ositional and named ones (nicolas-grekas)

This PR was merged into the 5.4 branch.

Discussion
----------

[DependencyInjection] Fix order of arguments when mixing positional and named ones

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

Commits
-------

45d614d [DependencyInjection] Fix order of arguments when mixing positional and named ones
@msteltenpool
Copy link
Author

Hi @nicolas-grekas thanks again for the fix! Could a tag be created as well (or is there a set policy for when that is done)? Would fix our latest builds from failing.

@derrabus
Copy link
Member

derrabus commented Jan 31, 2023

Could a tag be created as well

It will be created eventually, but we don't push new releases for every bugfix we merge. Please use "symfony/dependency-injection": "~6.2.6@dev" in your composer.json if you need the fix right now.

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

No branches or pull requests

6 participants