Skip to content

Commit

Permalink
Zachytávání error a warning pomocí libxml_use_internal_errors(TRUE) a…
Browse files Browse the repository at this point in the history
… libxml_get_errors()
  • Loading branch information
[email protected] committed Apr 21, 2017
1 parent ec87686 commit 8ce99a0
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/SmartEmailing.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 8ce99a0

Please sign in to comment.