Home » support » General discussion » [FIXED in 1.1.5] symfony outputs garbage characters before and after html code
| [FIXED in 1.1.5] symfony outputs garbage characters before and after html code [message #61530] |
Mon, 22 September 2008 16:00  |
xpuc Messages: 47 Registered: May 2007 |
Member |
|
|
Hi all,
there is a strange problem I see both in my own symfony projects and in some symfony-project.org pages: In the content the browser receives, there are some "garbage" number characters before and after the html content.
I'm currently seeing this problem when accessing the following page in IE6:
http://www.symfony-project.org/blog/2008/09/21/a-week-of-sym fony-90-15-21-september-2008
In the rendered page, I see the number characters "7ced" in the top left above the "symfony" header. When viewing the HTML source code, the beginning of the document looks so:
7ced
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/2000/REC-xhtml1-200000126/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
...
and in the end of the document there is a "0" character on a new line after the closing "</html>"
The characters in before the beginning of the document vary by page, but they are always four hex digits.
Another URL I see this problem is my own project I'm currently working on:
www.tuebingen.de/vereine
(there's a "3b44" before the beginning of the document)
It's already driving me crazy... But here are some facts I found out so far:
1. The four hex digits are visible in IE6 (and thats a huge problem: they break IE's "standards mode" and pages look terrible)
2. In Firefox3, those pages are handled differently: my own pages (www.tuebingen.de/vereine) display just nicely without error (and in the source code view the garbage characters are not visible). But other pages from symfony-project.org show the "Content Encoding Error" discussed in the following topics:
http://www.symfony-project.org/forum/index.php/t/15612/
http://www.symfony-project.org/forum/index.php/m/58759/#msg_ 58759
That's why I think those problems are related.
3. The Firefox problem seems to bee related to a proxy server (Yes, I'm behind a proxy).
But in my own project the garbage characters are in the source code even when I do a "telnet 127.0.0.1 80" and then "GET / HTTP/1.0" on the server that hosts my project - the strange hex digits are already there in the HTTP answer from the server! There is no proxy in between.
4. My theory on how Firefox handles this problem: When the page content is not gzipped and / or is not delivered via a proxy, Firefox just ignores the garbage bytes (and even doesnt show them in the source code view). But behind a proxy and in conjunction with gzipping Firefox brings this "Content Encoding Error" message.
5. Where do those strange bytes come from??? I really have no idea. What I know for sure: They are nowhere in the source code. And they are somehow related to the content of a page. In my projects, some pages show this behaviour, others not. The same on symfony-project.org: Some blog posts I can read without problems, others not.
6. I have not seen this problem yet on other than symfony-driven sites. And other PHP scripts running on the same server don't show those strange bytes. That's why the problem must somehow be symfony-related.
7. Because only IE displays the strange bytes an other browsers don't, I thought it could be an IE problem. But, as said above, the problem is there even when telneting on the command line, also when fetching the page using wget. So there MUST something be wrong in the source code already, but browsers other than IE just ignore it, except for Firefox 3 in conjunction with compressed content and proxy...
Any ideas???? It's really mysterious... Some bogus UTF-8 bytes? I have no idea.
What could be interesting:
- do others see the problem in http://www.symfony-project.org/blog/2008/09/21/a-week-of-sym fony-90-15-21-september-2008, in which browser, behind a proxy or not?
- do you see (and in which browser) the "3b44" when viewing my project www.tuebingen.de/vereine?
Please help!!! I need to solve this problem soon, because my pages look so terrible in IE because this problem triggers quirks mode!
[Updated on: Fri, 21 November 2008 11:18]
|
|
|
| Re: symfony outputs garbage characters before and after html code [message #61535 is a reply to message #61530 ] |
Mon, 22 September 2008 16:19   |
halfer Messages: 9535 Registered: January 2006 Location: West Midlands, UK |
Faithful Member |
|
|
Interesting - I see your website fine, in FF2/WinXPSP2, with a proxy between me and the Internet. Perhaps your website is OK and your LAN proxy is broken?
Edit: FF2 reports your website is being rendered in standards mode.
[Updated on: Mon, 22 September 2008 16:20] Remember Palestine
|
|
|
| Re: symfony outputs garbage characters before and after html code [message #61539 is a reply to message #61530 ] |
Mon, 22 September 2008 16:42   |
halfer Messages: 9535 Registered: January 2006 Location: West Midlands, UK |
Faithful Member |
|
|
Try a "GET / HTTP/1.1" when accessing your website via telnet - perhaps the compression etc. used is not supported in HTTP 1.0?
Remember Palestine
|
|
| | |
| Re: symfony outputs garbage characters before and after html code [message #61552 is a reply to message #61530 ] |
Mon, 22 September 2008 17:42   |
xpuc Messages: 47 Registered: May 2007 |
Member |
|
|
New Test:
I'm now in another office: other internet access provider, direct connection to the internet, no proxy.
Test URL is http://www.symfony-project.org/blog/2008/09/21/a-week-of-sym fony-90-15-21-september-2008
On the linux command line, I say:
$> wget http://www.symfony-project.org/blog/2008/09/21/a-week-of-symfony-90-15-21-september-2008
$> less a-week-of-symfony-90-15-21-september-2008
and what does it show me:
7cbe
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/2000/REC-xhtml1-200000126/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="title" content="symfony - open-source PHP web framework" />
<meta name="robots" content="index, follow" />
<meta name="description" content="symfony - open-source PHP web framework" />
<meta name="keywords" content="symfony, project, framework, php, php5, open-source, mit, symphony" />
<meta name="language" content="en" />
<link rel="stylesheet" type="text/css" media="all" href="/css/main.css" />
...
Again, those "7cbe" before the document. I don't think it's a broken proxy.
Could someone please confirm this?
|
|
|
| Re: symfony outputs garbage characters before and after html code [message #61561 is a reply to message #61548 ] |
Mon, 22 September 2008 18:32   |
halfer Messages: 9535 Registered: January 2006 Location: West Midlands, UK |
Faithful Member |
|
|
| Quote: | Thanks, that's nice to hear. But what about IE? Could you check it in IE, please?
|
There's no preceding characters in IE6.
| Quote: | Concerning quirks vs. standards mode: Firefox doesn't have the "feature" that it switches to quirks mode when there is some content before the doctype declaration (be it a space character) as IE does.
|
OK, I didn't know that, but in any case, I checked the FF source of your site, and there are no preceding characters.
Remember Palestine
|
|
|
| Re: symfony outputs garbage characters before and after html code [message #61563 is a reply to message #61530 ] |
Mon, 22 September 2008 18:33   |
halfer Messages: 9535 Registered: January 2006 Location: West Midlands, UK |
Faithful Member |
|
|
Try obtaining the headers from Firefox Web Developer - I am wondering if your server has been set up in HTTP 1.0 mode. Dump the headers here, in [code] tags, in case it helps anyone determine your issue.
Remember Palestine
|
|
| |
| Re: symfony outputs garbage characters before and after html code [message #61636 is a reply to message #61566 ] |
Tue, 23 September 2008 15:06   |
xpuc Messages: 47 Registered: May 2007 |
Member |
|
|
Some new findings:
- The hex number characters in the beginning of the document are there in almost every symfony generated page I have tested, when calling the page on the command line by telnet to port 80 and viewing the response.
And today I learned what they are for: They indicate the length of the chunks in the "chunked" transfer encoding of HTTP 1.1. This means, they are there by design.
- Those chunk size bytes are normally not displayed in any tested browser.
- In conjunction with some (buggy? HTTP 1.0?) proxies the browser does not understand the chunked encoding any more. IE displays the chunk size bytes as part of the content, Firefox3 displays an error message about "Content encoding error" (but only if the content was gzipped.)
Questions remaining:
- Why do I see this error only in symfony-based projects, while surfing all other sites on the internet via the same proxy works without problems?
- And why do I see the chunk size bytes in the response when doing a direct HTTP/1.0 request with telnet, without proxy? IMHO, there should be no chunked transfer encoding in a response to a HTTP/1.0 request because 1.0 clients don't understand this.
- Maybe this is the reason of the error: Symfony gives "chunked" 1.1 responses to HTTP/1.0 requests?
- Who actually does the chunked transfer encoding: is this Apache alone, or is Symfony involved there?
[Updated on: Tue, 23 September 2008 15:10]
|
|
|
| Re: symfony outputs garbage characters before and after html code [message #61643 is a reply to message #61530 ] |
Tue, 23 September 2008 16:38   |
halfer Messages: 9535 Registered: January 2006 Location: West Midlands, UK |
Faithful Member |
|
|
Dump your headers here?
Remember Palestine
|
|
|
| Re: symfony outputs garbage characters before and after html code [message #61724 is a reply to message #61643 ] |
Wed, 24 September 2008 12:47   |
xpuc Messages: 47 Registered: May 2007 |
Member |
|
|
OK, here are some headers.
At first:
http://www.symfony-project.org/api/1_1/, accessed via proxy, this is a page where Firefox says "Content encoding error" and IE6 shows chunk size bytes on top of the page. The headers are from Firefox (I don't know how to view/get the headers from IE):
GET /api/1_1/ HTTP/1.1
Host: www.symfony-project.org
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Proxy-Connection: keep-alive
Cookie: __utma=245056903.717489178.1196250376.1222240809.1222248553.90; re_ret=7; __utmz=245056903.1222171707.88.13.utmccn=(organic)|utmcsr=google|utmctr=transfer-encoding+chunked+symfony|utmcmd=organic; fud_session_1129964399=a349369afa8f05dc7f2e8730ad3d698a; symfony=ef147fa3c4b7af8d257ee6226ee2dfae; __utmc=245056903
HTTP/1.x 200 OK
Date: Wed, 24 Sep 2008 10:29:08 GMT
Server: Apache
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Etag: "dd54814397697c872bf751401c96c714"
Content-Encoding: gzip
Vary: Accept-Encoding
Transfer-Encoding: chunked
Content-Type: text/html; charset=utf-8
X-Cache: MISS from PROXYSERVER, MISS from r1stu026.tue.de
Proxy-Connection: close
Second example: headers of www.tuebingen.de/vereine, accessed via proxy, this page is correctly displayed in Firefox without error, but IE shows chunk size bytes. Again, the headers are from Firefox.
GET /vereine/ HTTP/1.1
Host: www.tuebingen.de
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Proxy-Connection: keep-alive
Cookie: vereinsdatenbank=3110359432f8e869b4d44017d39ba326; PHPSESSID=608865029edb634e6ca724db0931186f; symfony=7144cb1283703934b0127af4999c57ab
HTTP/1.x 200 OK
Date: Wed, 24 Sep 2008 10:36:24 GMT
Server: Apache/2.0.55 (Ubuntu) mod_jk/1.2.14
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 4854
Content-Type: text/html; charset=utf-8
X-Cache: MISS from PROXYSERVER, MISS from r1stu026.tue.de
Proxy-Connection: keep-alive
And last example: calling the same page as www.tuebingen.de/vereine, but locally on the server where this site runs via telnet:
~$ telnet localhost 80
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET /vereine/ HTTP/1.0
HTTP/1.1 200 OK
Date: Wed, 24 Sep 2008 10:43:44 GMT
Server: Apache/2.0.55 (Ubuntu) mod_jk/1.2.14
Set-Cookie: vereinsdatenbank=d1d8757e8a9899176b40c41b245fc0f8; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Vary: Accept-Encoding
Transfer-Encoding: chunked
Content-Type: text/html; charset=utf-8
3b44
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="de" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Language" content="de" />
<meta name="language" content="de" />
...
|
|
|
| Re: symfony outputs garbage characters before and after html code [message #61729 is a reply to message #61530 ] |
Wed, 24 September 2008 13:13   |
halfer Messages: 9535 Registered: January 2006 Location: West Midlands, UK |
Faithful Member |
|
|
I get this from the API page, via Firefox:
Via: 1.1 ourproxycompany.com:8081, 1.1 UKLPROXY01
Connection: Keep-Alive
Proxy-Connection: Keep-Alive
Content-Length: 102314
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Date: Wed, 24 Sep 2008 11:05:43 GMT
Content-Type: text/html; charset=utf-8
Etag: "dd54814397697c872bf751401c96c714"
Server: Apache
X-Bst-Request-Id: bT5pXg:hxl:31752
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
200 OK
I am just thinking out aloud here - try turning off PHP compression in your settings.yml (if it's on)?
Remember Palestine
|
|
| |
| Re: symfony outputs garbage characters before and after html code [message #63665 is a reply to message #61530 ] |
Wed, 22 October 2008 15:47   |
halfer Messages: 9535 Registered: January 2006 Location: West Midlands, UK |
Faithful Member |
|
|
|
@gaspard - I am not fully aware of the dev process, and you can ignore this advice if you know something I don't, but in general I'd advise you not to close tickets yourself. Personally I'd add any feedback as necessary, and reassign to the original ticket owner. That way if there is anything left to do on the ticket, it can be done and closed afterwards.
[Updated on: Wed, 22 October 2008 15:48] Remember Palestine
|
|
|
| Re: symfony outputs garbage characters before and after html code [message #65698 is a reply to message #63660 ] |
Fri, 21 November 2008 11:16  |
xpuc Messages: 47 Registered: May 2007 |
Member |
|
|
Now that 1.1.5 is released, I upgraded my projects - and really, the problem isn't there any more.
Thanks for fixing this bug!
|
|
|
Goto Forum:
|