fix php 8 warning when req has no content-type header
authorgggeek <giunta.gaetano@gmail.com>
Fri, 25 Nov 2022 11:05:28 +0000 (11:05 +0000)
committergggeek <giunta.gaetano@gmail.com>
Fri, 25 Nov 2022 11:05:28 +0000 (11:05 +0000)
src/Request.php

index 5af3e41..e356008 100644 (file)
@@ -279,7 +279,10 @@ class Request
         }
 
         // try to 'guestimate' the character encoding of the received response
-        $respEncoding = XMLParser::guessEncoding(@$this->httpResponse['headers']['content-type'], $data);
+        $respEncoding = XMLParser::guessEncoding(
+            isset($this->httpResponse['headers']['content-type']) ? $this->httpResponse['headers']['content-type'] : '',
+            $data
+        );
 
         if ($this->debug) {
             $start = strpos($data, '<!-- SERVER DEBUG INFO (BASE64 ENCODED):');