Skip to content

Commit

Permalink
disabled network access when loading XML documents
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Aug 28, 2012
1 parent c896d71 commit 47fe725
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
Expand Up @@ -216,7 +216,7 @@ private function parseFile($file)

$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();
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Routing/Loader/XmlFileLoader.php
Expand Up @@ -155,7 +155,7 @@ protected function loadFile($file)

$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();
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Serializer/Encoder/XmlEncoder.php
Expand Up @@ -59,7 +59,7 @@ public function decode($data, $format)
libxml_clear_errors();

$dom = new \DOMDocument();
$dom->loadXML($data);
$dom->loadXML($data, LIBXML_NONET);

libxml_use_internal_errors($internalErrors);
libxml_disable_entity_loader($disableEntities);
Expand Down
Expand Up @@ -60,7 +60,7 @@ private function parseFile($file)

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

Expand Down
Expand Up @@ -185,7 +185,7 @@ protected function parseFile($file)

$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')) {
Expand Down

0 comments on commit 47fe725

Please sign in to comment.