views:

548

answers:

4

For some reason my site http://tom.hsc.be displays a "Cannot display this message" error in those browsers while working correctly in Firefox, Opera, Safari and IE8.

It looks like this: http://www.reviewsaurus.com/images/pagedisplay.png

This document was successfully checked as XHTML 1.0 Transitional!

Found the problem:

Was using the following procedures to remove unnecessary characters, seems to be wrong though.

<?php   
function callback($buffer) 
{ 
    $holdit=$buffer;
    $holdit=str_replace("   ", " ", $holdit); // tab
    $holdit=str_replace("  ", " ", $holdit); // double space
    $holdit=str_replace("\n", " ", $holdit); // new line
    $holdit=str_replace("\r", " ", $holdit); // new line
    $holdit = eregi_replace("<!--[^>]*-->"," ",$holdit); // comment
    return $holdit; 
}
ob_start("ob_gzhandler"); 
ob_start("callback");
?>

Seems I don't need that function either, it is faster without it.
(I should probably have opted for a single eregi_replace too)

Thank you everyone, I like Stack Overflow. :-)

+1  A: 

It's not valid XHTML. If IE6/7 is actually interpreting it as XML, this will cause it to stop parsing. Can you give a screenshot to show what the failure looks like?

UPDATE: Now that it is XHTML Transitional, it's validating, and I'm out of suggestions until I get someplace I can run IE.

UPDATE 2: Just ran IE7 against the site, and the page loaded fine.

Hank Gay
I think your link is bugged, but I'll still try to see if I can avoid letting it be interpreted as XML.
TomWij
A: 

This document was successfully checked as XHTML 1.0 Transitional!

It still doesn't work though...

Found the problem:

Was using the following procedures to remove unnecessary characters, seems to be wrong though.

<?php   
function callback($buffer) 
{ 
 $holdit=$buffer;
 $holdit=str_replace(" ", " ", $holdit); // tab
 $holdit=str_replace("  ", " ", $holdit); // double space
 $holdit=str_replace("\n", " ", $holdit); // new line
 $holdit=str_replace("\r", " ", $holdit); // new line
 $holdit = eregi_replace("<!--[^>]*-->"," ",$holdit); // comment
 return $holdit; 
}
ob_start("ob_gzhandler"); 
ob_start("callback");
?>

Seems I don't need that function either, it is faster without it.
(I should probably have opted for a single eregi_replace too)

TomWij
It is loading for me. Clear your cache.
Paolo Bergantino
Yeah, just removed that function from my code. ;-)
TomWij
You should be using preg_replace() rather than eregi_replace(). The preg functions are faster and the ereg functions will be deprecated in PHP 5.3: http://wiki.php.net/doc/scratchpad/upgrade/53#deprecated
mercator
Thank you, will check it later on and do extensive testing using IE6 and IE7 that time.
TomWij
A: 

It's displaying fine, albeit slowly, in IE7 for me. I would still recommend fixing the two errors and validate as Strict, but they don't seem to me to be the cause of your problem. IE6 and IE7 are intepreting them as text/html.

Scott
+3  A: 

It doesn't have anything to do with HTML errors. The worst that can do is show a garbled or blank page.

There is some sort of server misconfiguration going on of WordPress and the gzip Content-Encoding.

http://tom.hsc.be/ doesn't work in IE, but http://tom.hsc.be/index.php loads just fine. Inspecting the raw HTTP Response (using Fiddler2), the difference between the two responses is that on the request to /, WordPress (presumably) adds the following text to the gzipped HTTP response body:

<!-- Page not cached by WP Super Cache. No closing HTML tag. Check your theme. -->

Because of that addition to the gzipped content, it's no longer a proper gzip stream, and IE6/7 can't ungzip it.

Other browsers probably have better error handling, so they can handle the error just fine.

I don't know how you can fix that problem, but a Google search for that piece of text turns up a few hits on wordpress.org at least.

mercator
Hmm, interesting, that's why it's sometimes just creating normal pages...
TomWij
Seems the function caused that, will still randomly look for it...<!-- Cached page generated by WP-Super-Cache on 2009-03-31 20:39:04 -->
TomWij