-
Notifications
You must be signed in to change notification settings - Fork 184
fix: remove twig extension if TwigBundle is not installed #974
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,6 +25,7 @@ | |
| use Sentry\SentryBundle\Tracing\Doctrine\DBAL\ConnectionConfigurator; | ||
| use Sentry\SentryBundle\Tracing\Doctrine\DBAL\TracingDriverMiddleware; | ||
| use Sentry\SentryBundle\Tracing\Twig\TwigTracingExtension; | ||
| use Sentry\SentryBundle\Twig\SentryExtension as TwigSentryExtension; | ||
| use Sentry\Serializer\RepresentationSerializer; | ||
| use Symfony\Bundle\TwigBundle\TwigBundle; | ||
| use Symfony\Component\Cache\CacheItem; | ||
|
|
@@ -71,7 +72,7 @@ protected function loadInternal(array $mergedConfig, ContainerBuilder $container | |
|
|
||
| // Remove Twig extension service if Twig is not installed to avoid autoloading failures on Symfony 8 | ||
| if (!class_exists(\Twig\Extension\AbstractExtension::class)) { | ||
| $container->removeDefinition(\Sentry\SentryBundle\Twig\SentryExtension::class); | ||
| $container->removeDefinition(TwigSentryExtension::class); | ||
| } | ||
|
|
||
| $this->registerConfiguration($container, $mergedConfig); | ||
|
|
@@ -281,6 +282,7 @@ private function registerTwigTracingConfiguration(ContainerBuilder $container, a | |
| } | ||
|
|
||
| if (!$isConfigEnabled) { | ||
| $container->removeDefinition(TwigSentryExtension::class); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: TwigSentryExtension incorrectly removed when tracing disabled
|
||
| $container->removeDefinition(TwigTracingExtension::class); | ||
| } | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: TwigTracingExtension not removed when Twig unavailable
When
AbstractExtensiondoesn't exist (Twig not installed), onlyTwigSentryExtensionis removed. However,TwigTracingExtensionalso extendsAbstractExtensionand will cause autoloading failures if Twig is unavailable. Both extensions should be removed when checking for Twig availability to prevent compilation errors on Symfony 8.