Skip to content

Commit

Permalink
[WebProfilerBundle] removed the WDT on malformed HTML content
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Feb 19, 2011
1 parent 2c45611 commit 0834bf4
Showing 1 changed file with 4 additions and 3 deletions.
Expand Up @@ -22,6 +22,9 @@
*
* 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>
*/
class WebDebugToolbarListener
Expand Down Expand Up @@ -83,9 +86,7 @@ protected function injectToolbar(Response $response)
$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();

if (false === $pos = $posrFunction($content, '</body>')) {
$content .= $toolbar;
} else {
if (false !== $pos = $posrFunction($content, '</body>')) {
$content = $substrFunction($content, 0, $pos).$toolbar.$substrFunction($content, $pos);
}

Expand Down

0 comments on commit 0834bf4

Please sign in to comment.