From 8ce99a02f4ba0b88e74111f6df0b985430025fca Mon Sep 17 00:00:00 2001 From: "honza@appsdevteam.com" Date: Fri, 21 Apr 2017 10:19:51 +0200 Subject: [PATCH] =?UTF-8?q?Zachyt=C3=A1v=C3=A1n=C3=AD=20error=20a=20warnin?= =?UTF-8?q?g=20pomoc=C3=AD=20libxml=5Fuse=5Finternal=5Ferrors(TRUE)=20a=20?= =?UTF-8?q?libxml=5Fget=5Ferrors()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/SmartEmailing.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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;