Browse Source

Merge remote branch 'azogheb/webProfilerOptimization'

* azogheb/webProfilerOptimization:
  [WebProfilerBundle] Optimization to listener
Fabien Potencier 14 years ago
parent
commit
18e56409c6
1 changed files with 2 additions and 3 deletions
  1. 2 3
      src/Symfony/Bundle/WebProfilerBundle/WebDebugToolbarListener.php

+ 2 - 3
src/Symfony/Bundle/WebProfilerBundle/WebDebugToolbarListener.php

@@ -86,13 +86,12 @@ class WebDebugToolbarListener
             $substrFunction = 'substr';
         }
 
-        $toolbar = "\n".str_replace("\n", '', $this->templating->render('WebProfilerBundle:Profiler:toolbar_js.html.twig', array('token' => $response->headers->get('X-Debug-Token'))))."\n";
         $content = $response->getContent();
 
         if (false !== $pos = $posrFunction($content, '</body>')) {
+            $toolbar = "\n".str_replace("\n", '', $this->templating->render('WebProfilerBundle:Profiler:toolbar_js.html.twig', array('token' => $response->headers->get('X-Debug-Token'))))."\n";
             $content = $substrFunction($content, 0, $pos).$toolbar.$substrFunction($content, $pos);
+            $response->setContent($content);
         }
-
-        $response->setContent($content);
     }
 }