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
-------
79e898ffe8
remove CSRF Twig extension when class is missing
This commit is contained in:
commit
179fe2f8c9
@ -14,6 +14,7 @@ namespace Symfony\Bundle\FrameworkBundle\DependencyInjection;
|
|||||||
use Doctrine\Common\Annotations\Reader;
|
use Doctrine\Common\Annotations\Reader;
|
||||||
use Doctrine\Common\Annotations\AnnotationRegistry;
|
use Doctrine\Common\Annotations\AnnotationRegistry;
|
||||||
use Symfony\Bridge\Monolog\Processor\DebugProcessor;
|
use Symfony\Bridge\Monolog\Processor\DebugProcessor;
|
||||||
|
use Symfony\Bridge\Twig\Extension\CsrfExtension;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||||
use Symfony\Bundle\FrameworkBundle\Routing\AnnotatedRouteControllerLoader;
|
use Symfony\Bundle\FrameworkBundle\Routing\AnnotatedRouteControllerLoader;
|
||||||
@ -1237,6 +1238,10 @@ class FrameworkExtension extends Extension
|
|||||||
|
|
||||||
// Enable services for CSRF protection (even without forms)
|
// Enable services for CSRF protection (even without forms)
|
||||||
$loader->load('security_csrf.xml');
|
$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)
|
private function registerSerializerConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader)
|
||||||
|
Reference in New Issue
Block a user