Skip to content

Commit 53930ad

Browse files
authored
Merge pull request #4 from AppsDevTeam/hotfix-isValidXmlString
zrusena funkcia isValidXmlString($xmlString)
2 parents b2ab53b + c3fc8f2 commit 53930ad

1 file changed

Lines changed: 3 additions & 24 deletions

File tree

src/SmartEmailing.php

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

296+
$xml = simplexml_load_string($response);
296297

297-
if ($this->isValidXmlString($response)) {
298-
return new \SimpleXMLElement($response);
299-
298+
if ($xml !== FALSE) {
299+
return $xml;
300300
} else {
301301
return $this->getErrorXml('500', 'Unknown Smartemailing API error.');
302302
}
@@ -319,25 +319,4 @@ public function getErrorXml($code, $message) {
319319
return $xml;
320320
}
321321

322-
323-
/**
324-
* check if xml string is valid
325-
*
326-
* @param string $xmlString
327-
* @return bool
328-
*/
329-
protected function isValidXmlString($xmlString) {
330-
libxml_use_internal_errors(TRUE);
331-
332-
$doc = simplexml_load_string($xmlString);
333-
334-
if (!$doc) {
335-
$errors = libxml_get_errors();
336-
337-
return empty($errors);
338-
}
339-
340-
return FALSE;
341-
}
342-
343322
}

0 commit comments

Comments
 (0)