diff --git a/src/Delivery/NovaPoshtaApi2.php b/src/Delivery/NovaPoshtaApi2.php index 042b17d..a905fbc 100644 --- a/src/Delivery/NovaPoshtaApi2.php +++ b/src/Delivery/NovaPoshtaApi2.php @@ -275,7 +275,7 @@ private function request($model, $method, $params = null) if ('curl' == $this->getConnectionType()) { $ch = curl_init($url); - if (is_resource($ch)) { + if ($this->isValidCurlHandler($ch)) { curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: '.('xml' == $this->format ? 'text/xml' : 'application/json'))); curl_setopt($ch, CURLOPT_HEADER, 0); @@ -1102,4 +1102,9 @@ public function printMarkings($documentRefs, $type = 'new_html', $size = '85x85' // If needs data return $this->request('InternetDocument', $method, array('DocumentRefs' => $documentRefs, 'Type' => $type)); } + + private function isValidCurlHandler($ch) + { + return is_resource($ch) || (version_compare(PHP_VERSION, '8.0.0') >= 0 && $ch instanceof \CurlHandle); + } }