* Fix XML validity checks in parser tests on PHP 5.1
authorBrion Vibber <brion@users.mediawiki.org>
Sat, 3 Dec 2005 08:14:07 +0000 (08:14 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Sat, 3 Dec 2005 08:14:07 +0000 (08:14 +0000)
RELEASE-NOTES
maintenance/parserTests.inc

index 9de94b5..7abf2f5 100644 (file)
@@ -282,6 +282,7 @@ fully support the editing toolbar, but was found to be too confusing.
 * (bug 1850) Allow red-links on image pages linked with [[:image:foo]]
 * (bug 360) Let Whatlinkshere track [[:image:foo]] links
 * (bug 4153) Fix block length localizations in Greek
+* Fix XML validity checks in parser tests on PHP 5.1
 
 
 === Caveats ===
index 8197a76..06c3a4a 100644 (file)
@@ -662,10 +662,26 @@ class ParserTest {
                return $text;
        }
        
+       /**
+        * Hack up a private DOCTYPE with HTML's standard entity declarations.
+        * PHP 4 seemed to know these if you gave it an HTML doctype, but
+        * PHP 5.1 doesn't.
+        * @return string
+        * @access private
+        */
+       function hackDocType() {
+               global $wgHtmlEntities;
+               $out = "<!DOCTYPE html [\n";
+               foreach( $wgHtmlEntities as $entity => $codepoint ) {
+                       $out .= "<!ENTITY $entity \"&#$codepoint;\">";
+               }
+               $out .= "]>\n";
+               return $out;
+       }
+       
        function wellFormed( $text ) {
                $html = 
-                       '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ' .
-                       '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' .
+                       $this->hackDocType() .
                        '<html>' .
                        $text .
                        '</html>';