Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Commit

Permalink
Disable external loading on DOM and Soap components use of DOMDocument
Browse files Browse the repository at this point in the history
  • Loading branch information
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -660,11 +660,12 @@ protected function _setRequest($request)
} else {
$xml = $request;
}

libxml_disable_entity_loader(true);
$dom = new DOMDocument();
if(strlen($xml) == 0 || !$dom->loadXML($xml)) {
throw new Exception\InvalidArgumentException('Invalid XML');
}
libxml_disable_entity_loader(false);
}
$this->request = $xml;
return $this;
Expand Down
5 changes: 4 additions & 1 deletion src/Wsdl.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,14 @@ public function __construct($name, $uri, ComplexTypeStrategy $strategy = null, a
xmlns:xsd='http://www.w3.org/2001/XMLSchema'
xmlns:soap-enc='http://schemas.xmlsoap.org/soap/encoding/'
xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'></definitions>";
libxml_disable_entity_loader(true);
$this->dom = new DOMDocument();
if (!$this->dom->loadXML($wsdl)) {
throw new Exception\RuntimeException('Unable to create DomDocument');
} else {
$this->wsdl = $this->dom->documentElement;
}

libxml_disable_entity_loader(false);
$this->setComplexTypeStrategy($strategy ?: new Wsdl\ComplexTypeStrategy\DefaultComplexType);
}

Expand Down Expand Up @@ -135,8 +136,10 @@ public function setUri($uri)
// @todo: This is the worst hack ever, but its needed due to design and non BC issues of WSDL generation
$xml = $this->dom->saveXML();
$xml = str_replace($oldUri, $uri, $xml);
libxml_disable_entity_loader(true);
$this->dom = new DOMDocument();
$this->dom->loadXML($xml);
libxml_disable_entity_loader(false);
}

return $this;
Expand Down

0 comments on commit 1c0be41

Please sign in to comment.