jenkins-bot has submitted this change and it was merged.

Change subject: LocalisationCache: Use file_get_contents instead of 
DOMDocument::load
......................................................................


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
---
M includes/cache/LocalisationCache.php
1 file changed, 6 insertions(+), 1 deletion(-)

Approvals:
  Krinkle: Looks good to me, but someone else must approve
  Mattflaschen: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/cache/LocalisationCache.php 
b/includes/cache/LocalisationCache.php
index 03162c0..c3e5e1d 100644
--- a/includes/cache/LocalisationCache.php
+++ b/includes/cache/LocalisationCache.php
@@ -656,8 +656,13 @@
         * @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' );

-- 
To view, visit https://gerrit.wikimedia.org/r/149507
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Idcb4ab1cef2a7b080543e7cc1cee5464fc476456
Gerrit-PatchSet: 6
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: TTO <[email protected]>
Gerrit-Reviewer: CSteipp <[email protected]>
Gerrit-Reviewer: John Vandenberg <[email protected]>
Gerrit-Reviewer: Jsahleen <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: Mattflaschen <[email protected]>
Gerrit-Reviewer: Nikerabbit <[email protected]>
Gerrit-Reviewer: Santhosh <[email protected]>
Gerrit-Reviewer: TTO <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to