Commit 82ac836e authored by Kristian Feldsam's avatar Kristian Feldsam
Browse files

Handle non-XML responses


Signed-off-by: Kristian Feldsam's avatarKristián Feldsam <feldsam@gmail.com>
parent f144aff7
......@@ -20,6 +20,7 @@
"php": ">=7.1",
"ext-simplexml": "*",
"ext-curl": "*",
"ext-libxml": "*",
"phpxmlrpc/phpxmlrpc": "^4.4",
"adbario/php-dot-notation": "^2.2"
},
......
......@@ -70,7 +70,17 @@ class OneBase {
));
}
return new Resource(self::simplexmlToArray(simplexml_load_string($body)));
// parse xml with proper error handling
libxml_use_internal_errors(true);
$xml = simplexml_load_string($body);
// response is not a XML, it can be some sort of ID
if (!$xml) {
return new Resource(['ID' => $body]);
}
return new Resource(self::simplexmlToArray($xml));
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment