Browse Source

[WebProfilerBundle] fixed WDT to keep the current flashes for one more request

Fabien Potencier 14 years ago
parent
commit
8421f95476

+ 6 - 1
src/Symfony/Bundle/WebProfilerBundle/WebDebugToolbarListener.php

@@ -47,7 +47,13 @@ class WebDebugToolbarListener
             return $response;
             return $response;
         }
         }
 
 
+        $request = $event->get('request');
+
+        // keep current flashes for one more request
+        $request->setFlashes($request->getFlashes());
+
         if ($response->headers->has('X-Debug-Token') && $response->isRedirect() && $this->interceptRedirects) {
         if ($response->headers->has('X-Debug-Token') && $response->isRedirect() && $this->interceptRedirects) {
+
             $response->setContent(
             $response->setContent(
                 sprintf('<html><head></head><body><h1>This Request redirects to<br /><a href="%1$s">%1$s</a>.</h1><h4>The redirect was intercepted by the web debug toolbar to help debugging.<br/>For more information, see the "intercept-redirects" option of the Profiler.</h4></body></html>',
                 sprintf('<html><head></head><body><h1>This Request redirects to<br /><a href="%1$s">%1$s</a>.</h1><h4>The redirect was intercepted by the web debug toolbar to help debugging.<br/>For more information, see the "intercept-redirects" option of the Profiler.</h4></body></html>',
                 $response->headers->get('Location'))
                 $response->headers->get('Location'))
@@ -56,7 +62,6 @@ class WebDebugToolbarListener
             $response->headers->remove('Location');
             $response->headers->remove('Location');
         }
         }
 
 
-        $request = $event->get('request');
         if (!$response->headers->has('X-Debug-Token')
         if (!$response->headers->has('X-Debug-Token')
             || '3' === substr($response->getStatusCode(), 0, 1)
             || '3' === substr($response->getStatusCode(), 0, 1)
             || ($response->headers->has('Content-Type') && false === strpos($response->headers->get('Content-Type'), 'html'))
             || ($response->headers->has('Content-Type') && false === strpos($response->headers->get('Content-Type'), 'html'))