-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Symfony 7.3 cannot boot if the kernel implements CompilerPassInterface #60191
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
Comments
im wondering if we can reproduce it using GHA :) maybe not this specific case, but at least a default install |
I edited the kernel to implements CompilerPassInterface. But yes, should be quite easy |
The It can be fixed by reverting this configuration for services implementing Ex: diff --git a/src/Symfony/Component/DependencyInjection/Compiler/ResolveInstanceofConditionalsPass.php b/src/Symfony/Component/DependencyInjection/Compiler/ResolveInstanceofConditionalsPass.php
index 90d4569c42..023dc7068a 100644
--- a/src/Symfony/Component/DependencyInjection/Compiler/ResolveInstanceofConditionalsPass.php
+++ b/src/Symfony/Component/DependencyInjection/Compiler/ResolveInstanceofConditionalsPass.php
@@ -16,6 +16,7 @@ use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
+use Symfony\Component\HttpKernel\KernelInterface;
/**
* Applies instanceof conditionals to definitions.
@@ -68,6 +69,7 @@ class ResolveInstanceofConditionalsPass implements CompilerPassInterface
$instanceofBindings = [];
$reflectionClass = null;
$parent = $definition instanceof ChildDefinition ? $definition->getParent() : null;
+ $isKernel = is_subclass_of($class, KernelInterface::class);
foreach ($conditionals as $interface => $instanceofDefs) {
if ($interface !== $class && !($reflectionClass ??= $container->getReflectionClass($class, false) ?: false)) {
@@ -78,6 +80,11 @@ class ResolveInstanceofConditionalsPass implements CompilerPassInterface
continue;
}
+ // Skip exclusion for Kernel added in FrameworkBundle
+ if ($isKernel && CompilerPassInterface::class === $interface) {
+ continue;
+ }
+
foreach ($instanceofDefs as $key => $instanceofDef) {
/** @var ChildDefinition $instanceofDef */
$instanceofDef = clone $instanceofDef; |
Symfony version(s) affected
7.3.latest
Description
If the kernel implements CompilerPassInterface, Symfony cannot boot (only in HTTP, cli is OK)
How to reproduce
Possible Solution
No response
Additional Context
No response
The text was updated successfully, but these errors were encountered: