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
1 changed files with 2 additions and 2 deletions

View File

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