Skip to content

Commit fddbc09

Browse files
committed
[WebProfiler] Removed intercept_redirects config option
1 parent 20f2a34 commit fddbc09

File tree

6 files changed

+2
-109
lines changed

6 files changed

+2
-109
lines changed

src/Symfony/Bundle/WebProfilerBundle/DependencyInjection/Configuration.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ public function getConfigTreeBuilder()
3636
$treeBuilder->getRootNode()
3737
->children()
3838
->booleanNode('toolbar')->defaultFalse()->end()
39-
->booleanNode('intercept_redirects')->defaultFalse()->setDeprecated('The "intercept_redirects" option is deprecated since version 4.4 and will be removed in 5.0.')->end()
4039
->scalarNode('excluded_ajax_paths')->defaultValue('^/((index|app(_[\w]+)?)\.php/)?_wdt')->end()
4140
->end()
4241
;

src/Symfony/Bundle/WebProfilerBundle/DependencyInjection/WebProfilerExtension.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,9 @@ public function load(array $configs, ContainerBuilder $container)
4646
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
4747
$loader->load('profiler.xml');
4848

49-
if ($config['toolbar'] || $config['intercept_redirects']) {
49+
if ($config['toolbar']) {
5050
$loader->load('toolbar.xml');
5151
$container->getDefinition('web_profiler.debug_toolbar')->replaceArgument(4, $config['excluded_ajax_paths']);
52-
$container->setParameter('web_profiler.debug_toolbar.intercept_redirects', $config['intercept_redirects']);
5352
$container->setParameter('web_profiler.debug_toolbar.mode', $config['toolbar'] ? WebDebugToolbarListener::ENABLED : WebDebugToolbarListener::DISABLED);
5453
}
5554

src/Symfony/Bundle/WebProfilerBundle/EventListener/WebDebugToolbarListener.php

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
1616
use Symfony\Component\HttpFoundation\Request;
1717
use Symfony\Component\HttpFoundation\Response;
18-
use Symfony\Component\HttpFoundation\Session\Flash\AutoExpireFlashBag;
1918
use Symfony\Component\HttpKernel\Event\ResponseEvent;
2019
use Symfony\Component\HttpKernel\KernelEvents;
2120
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
@@ -40,16 +39,14 @@ class WebDebugToolbarListener implements EventSubscriberInterface
4039

4140
protected $twig;
4241
protected $urlGenerator;
43-
protected $interceptRedirects;
4442
protected $mode;
4543
protected $excludedAjaxPaths;
4644
private $cspHandler;
4745

48-
public function __construct(Environment $twig, bool $interceptRedirects = false, int $mode = self::ENABLED, UrlGeneratorInterface $urlGenerator = null, string $excludedAjaxPaths = '^/bundles|^/_wdt', ContentSecurityPolicyHandler $cspHandler = null)
46+
public function __construct(Environment $twig, int $mode = self::ENABLED, UrlGeneratorInterface $urlGenerator = null, string $excludedAjaxPaths = '^/bundles|^/_wdt', ContentSecurityPolicyHandler $cspHandler = null)
4947
{
5048
$this->twig = $twig;
5149
$this->urlGenerator = $urlGenerator;
52-
$this->interceptRedirects = $interceptRedirects;
5350
$this->mode = $mode;
5451
$this->excludedAjaxPaths = $excludedAjaxPaths;
5552
$this->cspHandler = $cspHandler;
@@ -87,17 +84,6 @@ public function onKernelResponse(ResponseEvent $event)
8784
return;
8885
}
8986

90-
if ($response->headers->has('X-Debug-Token') && $response->isRedirect() && $this->interceptRedirects && 'html' === $request->getRequestFormat()) {
91-
if ($request->hasSession() && ($session = $request->getSession())->isStarted() && $session->getFlashBag() instanceof AutoExpireFlashBag) {
92-
// keep current flashes for one more request if using AutoExpireFlashBag
93-
$session->getFlashBag()->setAll($session->getFlashBag()->peekAll());
94-
}
95-
96-
$response->setContent($this->twig->render('@WebProfiler/Profiler/toolbar_redirect.html.twig', ['location' => $response->headers->get('Location')]));
97-
$response->setStatusCode(200);
98-
$response->headers->remove('Location');
99-
}
100-
10187
if (self::DISABLED === $this->mode
10288
|| !$response->headers->has('X-Debug-Token')
10389
|| $response->isRedirection()

src/Symfony/Bundle/WebProfilerBundle/Resources/config/toolbar.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
<service id="web_profiler.debug_toolbar" class="Symfony\Bundle\WebProfilerBundle\EventListener\WebDebugToolbarListener">
1111
<tag name="kernel.event_subscriber" />
1212
<argument type="service" id="twig" />
13-
<argument>%web_profiler.debug_toolbar.intercept_redirects%</argument>
1413
<argument>%web_profiler.debug_toolbar.mode%</argument>
1514
<argument type="service" id="router" on-invalid="ignore" />
1615
<argument /> <!-- paths that should be excluded from the AJAX requests shown in the toolbar -->

src/Symfony/Bundle/WebProfilerBundle/Tests/DependencyInjection/ConfigurationTest.php

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -35,63 +35,24 @@ public function getDebugModes()
3535
[
3636
'options' => [],
3737
'expectedResult' => [
38-
'intercept_redirects' => false,
3938
'toolbar' => false,
4039
'excluded_ajax_paths' => '^/((index|app(_[\w]+)?)\.php/)?_wdt',
4140
],
4241
],
4342
[
4443
'options' => ['toolbar' => true],
4544
'expectedResult' => [
46-
'intercept_redirects' => false,
4745
'toolbar' => true,
4846
'excluded_ajax_paths' => '^/((index|app(_[\w]+)?)\.php/)?_wdt',
4947
],
5048
],
5149
[
5250
'options' => ['excluded_ajax_paths' => 'test'],
5351
'expectedResult' => [
54-
'intercept_redirects' => false,
5552
'toolbar' => false,
5653
'excluded_ajax_paths' => 'test',
5754
],
5855
],
5956
];
6057
}
61-
62-
/**
63-
* @group legacy
64-
*
65-
* @dataProvider getInterceptRedirectsConfiguration
66-
*/
67-
public function testConfigTreeUsingInterceptRedirects(bool $interceptRedirects, array $expectedResult)
68-
{
69-
$processor = new Processor();
70-
$configuration = new Configuration();
71-
$config = $processor->processConfiguration($configuration, [['intercept_redirects' => $interceptRedirects]]);
72-
73-
$this->assertEquals($expectedResult, $config);
74-
}
75-
76-
public function getInterceptRedirectsConfiguration()
77-
{
78-
return [
79-
[
80-
'interceptRedirects' => true,
81-
'expectedResult' => [
82-
'intercept_redirects' => true,
83-
'toolbar' => false,
84-
'excluded_ajax_paths' => '^/((index|app(_[\w]+)?)\.php/)?_wdt',
85-
],
86-
],
87-
[
88-
'interceptRedirects' => false,
89-
'expectedResult' => [
90-
'intercept_redirects' => false,
91-
'toolbar' => false,
92-
'excluded_ajax_paths' => '^/((index|app(_[\w]+)?)\.php/)?_wdt',
93-
],
94-
],
95-
];
96-
}
9758
}

src/Symfony/Bundle/WebProfilerBundle/Tests/DependencyInjection/WebProfilerExtensionTest.php

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -141,57 +141,6 @@ public function getToolbarConfig()
141141
];
142142
}
143143

144-
/**
145-
* @group legacy
146-
*
147-
* @dataProvider getInterceptRedirectsToolbarConfig
148-
*/
149-
public function testToolbarConfigUsingInterceptRedirects(
150-
bool $toolbarEnabled,
151-
bool $interceptRedirects,
152-
bool $listenerInjected,
153-
bool $listenerEnabled
154-
) {
155-
$extension = new WebProfilerExtension();
156-
$extension->load(
157-
[['toolbar' => $toolbarEnabled, 'intercept_redirects' => $interceptRedirects]],
158-
$this->container
159-
);
160-
$this->container->removeDefinition('web_profiler.controller.exception');
161-
162-
$this->assertSame($listenerInjected, $this->container->has('web_profiler.debug_toolbar'));
163-
164-
self::assertSaneContainer($this->getCompiledContainer(), '', ['web_profiler.csp.handler']);
165-
166-
if ($listenerInjected) {
167-
$this->assertSame($listenerEnabled, $this->container->get('web_profiler.debug_toolbar')->isEnabled());
168-
}
169-
}
170-
171-
public function getInterceptRedirectsToolbarConfig()
172-
{
173-
return [
174-
[
175-
'toolbarEnabled' => false,
176-
'interceptRedirects' => true,
177-
'listenerInjected' => true,
178-
'listenerEnabled' => false,
179-
],
180-
[
181-
'toolbarEnabled' => false,
182-
'interceptRedirects' => false,
183-
'listenerInjected' => false,
184-
'listenerEnabled' => false,
185-
],
186-
[
187-
'toolbarEnabled' => true,
188-
'interceptRedirects' => true,
189-
'listenerInjected' => true,
190-
'listenerEnabled' => true,
191-
],
192-
];
193-
}
194-
195144
private function getCompiledContainer()
196145
{
197146
if ($this->container->has('web_profiler.debug_toolbar')) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy