Symfony 2 调试工具栏未显示,在开发环境中破坏 HTML
I really need your help with this. I don't know what I've done to break the Symfony 2 toolbar. The debug tool bars stop showing and when I look at the source code of the page, I can see something like this:
<!DOCTYPE html>
<html>
<head></head>
<body>
<h1>hello</h1>
<div id="sfwdt
and then the page terminates. This page I set up for debugging use the simplest HTML layout without using any variable and is not behind a firewall. I simply want to get the debugger toolbar showing. It looks like the debugger did try to load but for some reason it teminate at:
<div id="sfwdt
and breaks the entire page. If I turn the debugger off, the ending tag of the body and html come back.
I've searched for the occurrence of 'sfwdt' and it looks like it is from one of the twig templates of the profiler, however, when I modify that template to try things out, nothing change. Any one can point me to the right direction what's going wrong ?
And there's no error message found. I've comment out all services and keep it to the minimum, still no luck.
AppBundle/Resources/views/layout2.html.twig
<!DOCTYPE html>
<html>
<head></head>
<body>
<h1>hello</h1>
</body>
</html>
AppBundle/Resources/views/Default/index.html.twig
{% extends "AppBundle::layout2.html.twig" %}
解决方案
Sorry, I finally found the issue.
One of the custom bundles registers the kernel.response event and try adding a content-length header to the response. The content-length does not take into account the extra code for the debugger bar and it trims out the extra content added for the debugger toolbar !! and it explains why the page always terminates at <div id="sfwdt, because it takes the same number characters as body and html end tags
相关文章