Symfony 2调试工具栏未显示,破坏了开发环境中的HTML [英] Symfony 2 Debug Toolbar not showing, breaks HTML in dev environment

查看:171
本文介绍了Symfony 2调试工具栏未显示,破坏了开发环境中的HTML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我真的需要你的帮助。
我不知道我做了什么来打破Symfony 2工具栏。调试工具栏停止显示,当我查看页面的源代码时,我可以看到如下:

  ;!DOCTYPE html> 
< html>
< head>< / head>
< body>
< h1> hello< / h1>
< div id =sfwdt

然后页面终止。调试使用最简单的HTML布局,而不使用任何变量,而不是在防火墙后面。我只想让调试器工具栏显示,看起来调试器尝试加载,但由于某种原因,它尝试:

 < div id =sfwdt 

并打破整个页面。如果我关闭调试器,那么机身和html的结尾标签就会回来。



我搜索了'sfwdt'的发生,看起来就像然而,从分析器的一个树枝模板,当我修改该模板来尝试出来,没有任何改变。任何人都可以指出正确的方向是什么问题?



没有找到错误信息。我已经评论所有的服务,并将其保持在最低水平,仍然没有运气。



AppBundle / Resources / views / layout2.html.twig

 <!DOCTYPE html> 
< html>
< head>< / head>
< body>
< h1> hello< / h1>
< / body>
< / html>

AppBundle / Resources / views / Default / index.html.twig / p>

  {%extendsAppBundle :: layout2.html.twig%} 
/ pre>

解决方案

对不起,我终于找到了这个问题。



自定义捆绑包之一注册kernel.response事件,并尝试向响应添加内容长度标头。内容长度没有考虑到调试器条的额外代码,并且修剪了为调试器工具栏添加的额外内容!并且它解释了为什么页面总是在< div id =sfwdt终止,因为它需要与body和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

这篇关于Symfony 2调试工具栏未显示,破坏了开发环境中的HTML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆