Merge branch 'master' into 'master'

Enclose XML response to only contain the XML tags (trimming any possible...

See merge request davical-project/davical!82
This commit is contained in:
Nick v H 2024-09-13 20:06:26 +00:00
commit 4ca39306fc

View File

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