Skip to content

Commit 8ce99a0

Browse files
author
honza@appsdevteam.com
committed
Zachytávání error a warning pomocí libxml_use_internal_errors(TRUE) a libxml_get_errors()
1 parent ec87686 commit 8ce99a0

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/SmartEmailing.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -293,16 +293,17 @@ protected function callSmartemailingApiWithCurl($data) {
293293
return $this->getErrorXml($e->getCode(), $e->getMessage());
294294
}
295295

296-
libxml_use_internal_errors(TRUE);
296+
$previousInternalErrors = libxml_use_internal_errors(TRUE);
297+
libxml_clear_errors();
297298

298299
$xml = simplexml_load_string($response);
299300

300-
if (libxml_get_errors()) {
301+
if (!empty(libxml_get_errors())) {
301302
$xml = FALSE;
302-
libxml_clear_errors();
303303
}
304304

305-
libxml_use_internal_errors(FALSE);
305+
libxml_clear_errors();
306+
libxml_use_internal_errors($previousInternalErrors);
306307

307308
if ($xml !== FALSE) {
308309
return $xml;

0 commit comments

Comments
 (0)