disabled network access when loading XML documents

This commit is contained in:
Fabien Potencier 2012-08-27 13:36:18 +02:00
parent c896d71594
commit 47fe725bd4
5 changed files with 5 additions and 5 deletions

View File

@ -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();

View File

@ -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();

View File

@ -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);

View File

@ -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)));
}

View File

@ -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')) {