Add lots of @throws
[lhc/web/wiklou.git] / includes / cache / LocalisationCache.php
index 03162c0..472195c 100644 (file)
@@ -654,10 +654,16 @@ class LocalisationCache {
         * rules, and save the compiled rules in a process-local cache.
         *
         * @param string $fileName
+        * @throws MWException
         */
        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' );