Enclose XML response to only contain the XML tags (trimming any possible trailing characters after the last XML tag)

This commit is contained in:
Nick v H 2021-09-20 19:04:42 +00:00
parent c26ad777a2
commit 5920fe1efe

View File

@ -119,12 +119,13 @@ class CalDAVClient {
*/
function ParseResponse( $response ) {
$pos = strpos($response, '<?xml');
$epos = strrpos($response, '>');
if ($pos === false) {
$this->httpResponse = trim($response);
}
else {
$this->httpResponse = trim(substr($response, 0, $pos));
$this->xmlResponse = trim(substr($response, $pos));
$this->xmlResponse = trim(substr($response, $pos, $epos-$pos+1));
}
}