Skip to content
Permalink
Browse files

bug #26818 [FrameworkBundle] remove CSRF Twig extension when class is…

… missing (xabbuh)

This PR was merged into the 4.1-dev branch.

Discussion
----------

[FrameworkBundle] remove CSRF Twig extension when class is missing

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no>
| Tests pass?   | yes
| Fixed tickets | #26815
| License       | MIT
| Doc PR        |

Commits
-------

79e898f remove CSRF Twig extension when class is missing
  • Loading branch information...
fabpot committed Apr 6, 2018
2 parents f77c1d0 + 79e898f commit 179fe2f8c9f44b03516be89761342fb603dbbd22
Showing with 5 additions and 0 deletions.
  1. +5 −0 src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
@@ -14,6 +14,7 @@
use Doctrine\Common\Annotations\Reader;
use Doctrine\Common\Annotations\AnnotationRegistry;
use Symfony\Bridge\Monolog\Processor\DebugProcessor;
use Symfony\Bridge\Twig\Extension\CsrfExtension;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Bundle\FrameworkBundle\Routing\AnnotatedRouteControllerLoader;
@@ -1237,6 +1238,10 @@ private function registerSecurityCsrfConfiguration(array $config, ContainerBuild
// Enable services for CSRF protection (even without forms)
$loader->load('security_csrf.xml');
if (!class_exists(CsrfExtension::class)) {
$container->removeDefinition('twig.extension.security_csrf');
}
}
private function registerSerializerConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader)

0 comments on commit 179fe2f

Please sign in to comment.
You can’t perform that action at this time.