r11920 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r11919‎ | r11920 | r11921 >
Date:08:14, 3 December 2005
Author:vibber
Status:old
Tags:
Comment:
* Fix XML validity checks in parser tests on PHP 5.1
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/maintenance/parserTests.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/parserTests.inc
@@ -662,10 +662,26 @@
663663 return $text;
664664 }
665665
 666+ /**
 667+ * Hack up a private DOCTYPE with HTML's standard entity declarations.
 668+ * PHP 4 seemed to know these if you gave it an HTML doctype, but
 669+ * PHP 5.1 doesn't.
 670+ * @return string
 671+ * @access private
 672+ */
 673+ function hackDocType() {
 674+ global $wgHtmlEntities;
 675+ $out = "<!DOCTYPE html [\n";
 676+ foreach( $wgHtmlEntities as $entity => $codepoint ) {
 677+ $out .= "<!ENTITY $entity \"&#$codepoint;\">";
 678+ }
 679+ $out .= "]>\n";
 680+ return $out;
 681+ }
 682+
666683 function wellFormed( $text ) {
667684 $html =
668 - '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ' .
669 - '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' .
 685+ $this->hackDocType() .
670686 '<html>' .
671687 $text .
672688 '</html>';
Index: trunk/phase3/RELEASE-NOTES
@@ -282,6 +282,7 @@
283283 * (bug 1850) Allow red-links on image pages linked with [[:image:foo]]
284284 * (bug 360) Let Whatlinkshere track [[:image:foo]] links
285285 * (bug 4153) Fix block length localizations in Greek
 286+* Fix XML validity checks in parser tests on PHP 5.1
286287
287288
288289 === Caveats ===

Status & tagging log