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

Skip to content

[DependencyInjection][FrameworkBundle] Fix precedence of App\Kernel alias and ignore container.excluded tag on synthetic services #60392

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
May 9, 2025

Conversation

nicolas-grekas
Copy link
Member

Q A
Branch? 7.3
Bug fix? yes
New feature? no
Deprecations? no
Issues Fix #60191
License MIT

Autoconfiguration cannot make a service abstract so I'm removing the related calls, they're confusing.

Then, I'm moving the definition of the App\Kernel alias after loading services.yaml, so that the alias overrides the discovered corresponding class.

And I make instance-of-conditionals ignore container.excluded tags on synthetic services. An alternative could be to check if the class implements KernelInterface like proposed in #60191 (comment) but I think the rule I'm proposing here is more generic.

@carsonbot carsonbot added this to the 7.3 milestone May 9, 2025
@OskarStark OskarStark changed the title [DependencyInjection][FrameworkBundle] Fix precedence of App\Kernel alias and ignore container.excluded tag on synthetic services [DependencyInjection][FrameworkBundle] Fix precedence of App\Kernel alias and ignore container.excluded tag on synthetic services May 9, 2025
…lias and ignore container.excluded tag on synthetic services
@nicolas-grekas nicolas-grekas merged commit 27edcc2 into symfony:7.3 May 9, 2025
10 of 11 checks passed
@fabpot fabpot mentioned this pull request May 10, 2025
@adpeyre
Copy link
Contributor

adpeyre commented May 12, 2025

Hello @nicolas-grekas ,
I feel like these additions introduce a bug ?
With doctrine-bundle v2.14.0

Doctrine\ORM\Mapping\Embeddable" has already been autoconfigured and merge() does not support merging autoconfiguration for the same attribute

@nicolas-grekas nicolas-grekas deleted the fix-kernel-service branch May 12, 2025 15:09
@nicolas-grekas
Copy link
Member Author

@adpeyre I don't know, please provide a reproducer in a new issue if you can (I installed doctrine-bundle with Symfony 7.3 successfully, which means I cannot reproduce).

@nicolas-grekas
Copy link
Member Author

Note that this error message is not found anywhere in Symfony 7.3 so I'm skeptical.

@adpeyre
Copy link
Contributor

adpeyre commented May 12, 2025

I think the person in my team hasn't updated their symfony properly to test 7.3.... This appears to be symfony 7.2 code... Sorry Nicolas.

@kedarkhaire
Copy link

Hi @nicolas-grekas
We are getting issue on Symfony 7.2.6 & Drupal 11
Symfony\Component\DependencyInjection\Exception\RuntimeException: You have requested a synthetic service ("kernel"). The DIC does not know how to construct this service. in Symfony\Component\DependencyInjection\ContainerBuilder->createService() (line 1093 of vendor/symfony/dependency-injection/ContainerBuilder.php).
apigee/apigee-devportal-kickstart-drupal#733

Any plans to release this fix for Symfony 7.2 ?

@nicolas-grekas
Copy link
Member Author

nicolas-grekas commented May 21, 2025

You might experience something else. The attached patch is for 7.3.

@kedarkhaire
Copy link

Yes, I am experiencing this error on Symfony 7.2 & Drupal 11

Symfony\Component\DependencyInjection\Exception\RuntimeException: You have requested a synthetic service ("kernel"). The DIC does not know how to construct this service. in Symfony\Component\DependencyInjection\ContainerBuilder->createService() (line 1093 of vendor/symfony/dependency-injection/ContainerBuilder.php).

I am asking, can we look for this issue in Symfony7.2 ?
Do you want me to create a issue for this ?

@nicolas-grekas
Copy link
Member Author

nicolas-grekas commented May 21, 2025

You'd better ask Drupal before, I don't see how this can be related to Symfony itself. It'd rather look like a bug in the way Symfony is used.

@kedarkhaire
Copy link

Thanks @nicolas-grekas for clarifying things here.

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.

Symfony 7.3 cannot boot if the kernel implements CompilerPassInterface
7 participants