From 88d4228757218257ae97efa34554f3d0ffa9d976 Mon Sep 17 00:00:00 2001 From: Gareth Parker Date: Wed, 24 Jun 2020 15:55:12 +0100 Subject: [PATCH] Fixed an issue with certain characters in the returned xml --- .idea/.name | 1 - .idea/encodings.xml | 6 ------ .idea/scopes/scope_settings.xml | 5 ----- CHANGELOG.md | 3 ++- composer.json | 5 ++++- src/API/NTLMSoapClient.php | 13 ++++++++++++- 6 files changed, 18 insertions(+), 15 deletions(-) delete mode 100644 .idea/.name delete mode 100644 .idea/encodings.xml delete mode 100644 .idea/scopes/scope_settings.xml diff --git a/.idea/.name b/.idea/.name deleted file mode 100644 index da3fc47e..00000000 --- a/.idea/.name +++ /dev/null @@ -1 +0,0 @@ -php-ews \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml deleted file mode 100644 index f7589596..00000000 --- a/.idea/encodings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/scopes/scope_settings.xml b/.idea/scopes/scope_settings.xml deleted file mode 100644 index 922003b8..00000000 --- a/.idea/scopes/scope_settings.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index ad05b04c..95b73d11 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## 0.9.7 - TBD +## 0.9.7 - 2020-06-24 * Added a `$options = []` parameter to various methods * Made `ExchangeWebServices::drillDownResponses()` static * Added a `NotificationAPI::handlePushNotification()` method @@ -11,6 +11,7 @@ * Adding a simple usage for `setFrom` * `CalendarAPI::areAvailable` will now check for an error and throw a useful Exception * Updated the Restriction format to allow for multiple If's and nexted And's/Or's + * Fixed an issue with certain characters in the XML (Issue #180) ## 0.9.6 - 2018-01-26 * Added an `options` parameter to `CalendarAPI::updateCalendarItem()` diff --git a/composer.json b/composer.json index 235ce0f9..bdab0837 100644 --- a/composer.json +++ b/composer.json @@ -4,7 +4,10 @@ "require": { "garethp/http-playback": "^1.0", "ext-curl": "*", - "ext-soap": "*" + "ext-soap": "*", + "ext-libxml": "*", + "ext-dom": "*", + "ext-simplexml": "*" }, "scripts": { "cs": "./vendor/bin/phpcs --standard=ruleset.xml -np src/ tests/ examples/", diff --git a/src/API/NTLMSoapClient.php b/src/API/NTLMSoapClient.php index d89acdae..4f9e8311 100644 --- a/src/API/NTLMSoapClient.php +++ b/src/API/NTLMSoapClient.php @@ -208,7 +208,18 @@ public function __doRequest($request, $location, $action, $version, $one_way = 0 $this->__last_request_headers = $postOptions['headers']; $this->_responseCode = $response->getStatusCode(); - return $response->getBody()->__toString(); + $responseStr = $response->getBody()->__toString(); + libxml_use_internal_errors(true); + $dom = new \DOMDocument("1.0", "UTF-8"); + $dom->strictErrorChecking = false; + $dom->validateOnParse = false; + $dom->recover = true; + $dom->loadXML($responseStr); + $xml = simplexml_import_dom($dom); + libxml_clear_errors(); + libxml_use_internal_errors(false); + + return $xml->asXML(); } /**