|
@@ -22,6 +22,9 @@ use Symfony\Component\HttpKernel\HttpKernelInterface;
|
|
*
|
|
*
|
|
* The handle method must be connected to the core.response event.
|
|
* The handle method must be connected to the core.response event.
|
|
*
|
|
*
|
|
|
|
+ * The WDT is only injected on well-formed HTML (with a proper </body> tag).
|
|
|
|
+ * This means that the WDT is never included in sub-requests or ESI requests.
|
|
|
|
+ *
|
|
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
|
|
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
|
|
*/
|
|
*/
|
|
class WebDebugToolbarListener
|
|
class WebDebugToolbarListener
|
|
@@ -83,9 +86,7 @@ class WebDebugToolbarListener
|
|
$toolbar = "\n".str_replace("\n", '', $this->kernel->render('WebProfilerBundle:Profiler:toolbar', array('attributes' => array('token' => $response->headers->get('X-Debug-Token')))))."\n";
|
|
$toolbar = "\n".str_replace("\n", '', $this->kernel->render('WebProfilerBundle:Profiler:toolbar', array('attributes' => array('token' => $response->headers->get('X-Debug-Token')))))."\n";
|
|
$content = $response->getContent();
|
|
$content = $response->getContent();
|
|
|
|
|
|
- if (false === $pos = $posrFunction($content, '</body>')) {
|
|
|
|
- $content .= $toolbar;
|
|
|
|
- } else {
|
|
|
|
|
|
+ if (false !== $pos = $posrFunction($content, '</body>')) {
|
|
$content = $substrFunction($content, 0, $pos).$toolbar.$substrFunction($content, $pos);
|
|
$content = $substrFunction($content, 0, $pos).$toolbar.$substrFunction($content, $pos);
|
|
}
|
|
}
|
|
|
|
|