From: This, that and the other Date: Wed, 26 Nov 2014 09:02:09 +0000 (+1100) Subject: LocalisationCache: Use file_get_contents instead of DOMDocument::load X-Git-Tag: 1.31.0-rc.0~12968 X-Git-Url: http://git.cyclocoop.org//%27%40script%40/%27?a=commitdiff_plain;h=c139126841458ba1be4c1d2abb485c0d3584afd8;p=lhc%2Fweb%2Fwiklou.git LocalisationCache: Use file_get_contents instead of DOMDocument::load DOMDocument::load fails to load the plurals data during the import process. This is a work-around for https://bugs.php.net/bug.php?id=64938. This bug only rears its head when using Special:Import, because that is essentially the only place in MediaWiki where we fiddle with libxml_disable_entity_loader. Bug: T58439 Change-Id: Idcb4ab1cef2a7b080543e7cc1cee5464fc476456 --- diff --git a/includes/cache/LocalisationCache.php b/includes/cache/LocalisationCache.php index 03162c01eb..c3e5e1d23c 100644 --- a/includes/cache/LocalisationCache.php +++ b/includes/cache/LocalisationCache.php @@ -656,8 +656,13 @@ class LocalisationCache { * @param string $fileName */ protected function loadPluralFile( $fileName ) { + // Use file_get_contents instead of DOMDocument::load (T58439) + $xml = file_get_contents( $fileName ); + if ( !$xml ) { + throw new MWException( "Unable to read plurals file $fileName" ); + } $doc = new DOMDocument; - $doc->load( $fileName ); + $doc->loadXML( $xml ); $rulesets = $doc->getElementsByTagName( "pluralRules" ); foreach ( $rulesets as $ruleset ) { $codes = $ruleset->getAttribute( 'locales' );