[WebProfilerBundle] removed the WDT on malformed HTML content
This commit is contained in:
parent
2c45611f4e
commit
0834bf47dc
@ -22,6 +22,9 @@ use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
*
|
||||
* 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
|
||||
@ -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";
|
||||
$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);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user