]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Don't start HTML responses with <?xml if the document is served as text/html.
authorCraig Andrews <candrews@integralblue.com>
Wed, 5 Aug 2009 22:55:47 +0000 (18:55 -0400)
committerCraig Andrews <candrews@integralblue.com>
Wed, 5 Aug 2009 22:55:47 +0000 (18:55 -0400)
Starting a text/html mime type document with <?xml causes some browsers (previous version of Opera and IE) to switch to Quirks Mode.

lib/htmloutputter.php

index cba8a5f5e09b9023706c9635e27b3a80b51137cb..8f3b1a609c11ab1a8c777afea6c83db51083cd76 100644 (file)
@@ -109,8 +109,13 @@ class HTMLOutputter extends XMLOutputter
         header('Content-Type: '.$type);
 
         $this->extraHeaders();
-
-        $this->startXML('html');
+        if( ! substr($type,0,strlen('text/html'))=='text/html' ){
+            // Browsers don't like it when <?xml it output for non-xhtml documents
+            $this->xw->startDocument('1.0', 'UTF-8');
+        }
+        if ($doc) {
+            $this->xw->writeDTD('html', $public, $system);
+        }
 
         $language = $this->getLanguage();