ResourceLoaderImage: Use DomDocument::loadXml rather than DomDocument::load
authorBartosz Dziewoński <matma.rex@gmail.com>
Sun, 31 Jan 2016 22:23:27 +0000 (23:23 +0100)
committerBartosz Dziewoński <matma.rex@gmail.com>
Sun, 31 Jan 2016 22:26:37 +0000 (22:26 +0000)
Some users are reporting that DomDocument::load can't read the files
on their setups, while they can be read with file_get_contents. So use
that and pass the string to DomDocument::loadXml. The advantage of
DomDocument::load is supposed to be in handling large files, and the
icons here are supposed to be small.

Bug: T107198
Change-Id: I8e4dc4642f9d0c5f01ec5e4061e83bf09d0a4900

includes/resourceloader/ResourceLoaderImage.php

index 9d5fe38..1f35e1f 100644 (file)
@@ -272,7 +272,7 @@ class ResourceLoaderImage {
         */
        protected function variantize( $variantConf, ResourceLoaderContext $context ) {
                $dom = new DomDocument;
-               $dom->load( $this->getPath( $context ) );
+               $dom->loadXml( file_get_contents( $this->getPath( $context ) ) );
                $root = $dom->documentElement;
                $wrapper = $dom->createElement( 'g' );
                while ( $root->firstChild ) {