diff --git a/src/SmartEmailing.php b/src/SmartEmailing.php index 4b646ca..1db25d1 100644 --- a/src/SmartEmailing.php +++ b/src/SmartEmailing.php @@ -293,16 +293,17 @@ protected function callSmartemailingApiWithCurl($data) { return $this->getErrorXml($e->getCode(), $e->getMessage()); } - libxml_use_internal_errors(TRUE); + $previousInternalErrors = libxml_use_internal_errors(TRUE); + libxml_clear_errors(); $xml = simplexml_load_string($response); - if (libxml_get_errors()) { + if (!empty(libxml_get_errors())) { $xml = FALSE; - libxml_clear_errors(); } - libxml_use_internal_errors(FALSE); + libxml_clear_errors(); + libxml_use_internal_errors($previousInternalErrors); if ($xml !== FALSE) { return $xml;