Browse Source

disabled network access when loading XML documents

Fabien Potencier 12 years ago
parent
commit
47fe725bd4

+ 1 - 1
src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php

@@ -216,7 +216,7 @@ class XmlFileLoader extends FileLoader
 
         $dom = new \DOMDocument();
         $dom->validateOnParse = true;
-        if (!$dom->load($file, defined('LIBXML_COMPACT') ? LIBXML_COMPACT : 0)) {
+        if (!$dom->load($file, LIBXML_NONET | (defined('LIBXML_COMPACT') ? LIBXML_COMPACT : 0))) {
             throw new \InvalidArgumentException(implode("\n", $this->getXmlErrors($internalErrors)));
         }
         $dom->normalizeDocument();

+ 1 - 1
src/Symfony/Component/Routing/Loader/XmlFileLoader.php

@@ -155,7 +155,7 @@ class XmlFileLoader extends FileLoader
 
         $dom = new \DOMDocument();
         $dom->validateOnParse = true;
-        if (!$dom->load($file, defined('LIBXML_COMPACT') ? LIBXML_COMPACT : 0)) {
+        if (!$dom->load($file, LIBXML_NONET | (defined('LIBXML_COMPACT') ? LIBXML_COMPACT : 0))) {
             throw new \InvalidArgumentException(implode("\n", $this->getXmlErrors($internalErrors)));
         }
         $dom->normalizeDocument();

+ 1 - 1
src/Symfony/Component/Serializer/Encoder/XmlEncoder.php

@@ -59,7 +59,7 @@ class XmlEncoder extends SerializerAwareEncoder implements EncoderInterface, Dec
         libxml_clear_errors();
 
         $dom = new \DOMDocument();
-        $dom->loadXML($data);
+        $dom->loadXML($data, LIBXML_NONET);
 
         libxml_use_internal_errors($internalErrors);
         libxml_disable_entity_loader($disableEntities);

+ 1 - 1
src/Symfony/Component/Translation/Loader/XliffFileLoader.php

@@ -60,7 +60,7 @@ class XliffFileLoader implements LoaderInterface
 
         $dom = new \DOMDocument();
         $dom->validateOnParse = true;
-        if (!@$dom->load($file, defined('LIBXML_COMPACT') ? LIBXML_COMPACT : 0)) {
+        if (!@$dom->load($file, LIBXML_NONET | (defined('LIBXML_COMPACT') ? LIBXML_COMPACT : 0))) {
             throw new \RuntimeException(implode("\n", $this->getXmlErrors($internalErrors)));
         }
 

+ 1 - 1
src/Symfony/Component/Validator/Mapping/Loader/XmlFileLoader.php

@@ -185,7 +185,7 @@ class XmlFileLoader extends FileLoader
 
         $dom = new \DOMDocument();
         $dom->validateOnParse = true;
-        if (!$dom->load($file, defined('LIBXML_COMPACT') ? LIBXML_COMPACT : 0)) {
+        if (!$dom->load($file, LIBXML_NONET | (defined('LIBXML_COMPACT') ? LIBXML_COMPACT : 0))) {
             throw new MappingException(implode("\n", $this->getXmlErrors($internalErrors)));
         }
         if (!$dom->schemaValidate(__DIR__.'/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd')) {