We at Wikimedia never noticed this issue until we upgraded libxml2 on one of our servers as part of an OS upgrade, but apparently the interwebs knew about this since at least May 2010. Hat tip
to http://deriksmith.livejournal.com/57617.html , where I found this fix.
#REDIRECT [[Foo]] is invalid JS
* Tracking categories are no longer shown in footer for special pages
* $wgOverrideSiteFeed no longer double escapes urls.
+* The preprocessor no longer fails with a PHP warning about XML_PARSE_HUGE when
+ processing complex pages using newer versions of libxml2.
=== API changes in 1.18 ===
* BREAKING CHANGE: action=watch now requires POST and token.
if ( !$result ) {
// Try running the XML through UtfNormal to get rid of invalid characters
$xml = UtfNormal::cleanUp( $xml );
- $result = $dom->loadXML( $xml );
+ // 1 << 19 == XML_PARSE_HUGE, needed so newer versions of libxml2 don't barf when the XML is >256 levels deep
+ $result = $dom->loadXML( $xml, 1 << 19 );
if ( !$result ) {
throw new MWException( __METHOD__.' generated invalid XML' );
}