MagicEnvelope called DOMDocument::loadXML statically

but apparently we shouldn't do this, despite recommended on https://secure.php.net/manual/en/domdocument.loadxml.php
This commit is contained in:
Mikael Nordfeldth 2015-07-10 23:24:50 +02:00
parent 961031bc28
commit 24b1e26406

View File

@ -50,8 +50,8 @@ class MagicEnvelope
*/ */
public function __construct($xml=null) { public function __construct($xml=null) {
if (!empty($xml)) { if (!empty($xml)) {
$dom = DOMDocument::loadXML($xml); $dom = new DOMDocument();
if (!$dom instanceof DOMDocument) { if (!$dom->loadXML($xml)) {
throw new ServerException('Tried to load malformed XML as DOM'); throw new ServerException('Tried to load malformed XML as DOM');
} elseif (!$this->fromDom($dom)) { } elseif (!$this->fromDom($dom)) {
throw new ServerException('Could not load MagicEnvelope from DOM'); throw new ServerException('Could not load MagicEnvelope from DOM');