diff --git a/src/Model/Response/AbstractResponse.php b/src/Model/Response/AbstractResponse.php index c1584c2..2813254 100644 --- a/src/Model/Response/AbstractResponse.php +++ b/src/Model/Response/AbstractResponse.php @@ -76,12 +76,10 @@ abstract class AbstractResponse /** * AbstractResponse constructor. Sets response. - * - * @param \SimpleXmlElement $response */ - public function __construct(\SimpleXmlElement $response = null) + public function __construct($response = null) { - if ($response !== null) { + if ($response !== null && $response instanceof \SimpleXmlElement) { $this->setResponse($response); $this->setStatusCode((string) $this->getResponse()->head->processing->status->attributes()->code); diff --git a/src/Service/CommunicationService.php b/src/Service/CommunicationService.php index b345e19..8f317d3 100644 --- a/src/Service/CommunicationService.php +++ b/src/Service/CommunicationService.php @@ -90,8 +90,10 @@ public function send($xml, $connectionTimeout = 0, $executionTimeout = 0, $retri $statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); - // close connection - curl_close($ch); + if (version_compare(PHP_VERSION, '8.0.0', '<')) { // curl_close does nothing since 8.0 and is deprecated since 8.5 + // close connection + curl_close($ch); + } // status codes 3xx and 5xx are not processable by the SDK (we assume that the body will be invalid too) $invalidStatusCode = $statusCode < 200 || ($statusCode >= 300 && ($statusCode < 400 || $statusCode >= 500));