LocalisationCache: Use file_get_contents instead of DOMDocument::load
[lhc/web/wiklou.git] / includes / cache / LocalisationCache.php
index c79d008..c3e5e1d 100644 (file)
@@ -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' );
@@ -945,7 +950,7 @@ class LocalisationCache {
 
                        # Allow extensions an opportunity to adjust the data for this
                        # fallback
-                       wfRunHooks( 'LocalisationCacheRecacheFallback', array( $this, $csCode, &$csData ) );
+                       Hooks::run( 'LocalisationCacheRecacheFallback', array( $this, $csCode, &$csData ) );
 
                        # Merge the data for this fallback into the final array
                        if ( $csCode === $code ) {
@@ -1003,7 +1008,7 @@ class LocalisationCache {
                }
                # Run hooks
                $purgeBlobs = true;
-               wfRunHooks( 'LocalisationCacheRecache', array( $this, $code, &$allData, &$purgeBlobs ) );
+               Hooks::run( 'LocalisationCacheRecache', array( $this, $code, &$allData, &$purgeBlobs ) );
 
                if ( is_null( $allData['namespaceNames'] ) ) {
                        wfProfileOut( __METHOD__ );