Skip to content

Commit 90bafb9

Browse files
author
Chris Park
committed
Addressing Travis issues #1
1 parent 5ae4787 commit 90bafb9

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

source/rosette/api/Api.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ private function callEndpoint($parameters, $subUrl)
277277
{
278278
$this->checkVersion($this->service_url);
279279
$this->subUrl = $subUrl;
280-
$this->useMultiPart = $parameters->useMultiPart;
280+
$this->useMultiPart = isset($parameters->useMultiPart) ? $parameters->useMultiPart : null;
281281

282282
if ($this->useMultiPart) {
283283
$content = $parameters->content;
@@ -430,10 +430,12 @@ private function makeRequest($url, $headers, $data, $method)
430430
$response = explode(PHP_EOL, $response);
431431
$this->setResponseCode($resCode);
432432

433-
if (strlen($response[9]) > 3 && mb_strpos($response[9], "\x1f" . "\x8b" . "\x08", 0) === 0) {
434-
// a gzipped string starts with ID1(\x1f) ID2(\x8b) CM(\x08)
435-
// http://www.gzip.org/zlib/rfc-gzip.html#member-format
436-
$response = gzinflate(substr($response, 10, -8));
433+
if (count($response) > 8) {
434+
if (strlen($response[9]) > 3 && mb_strpos($response[9], "\x1f" . "\x8b" . "\x08", 0) === 0) {
435+
// a gzipped string starts with ID1(\x1f) ID2(\x8b) CM(\x08)
436+
// http://www.gzip.org/zlib/rfc-gzip.html#member-format
437+
$response = gzinflate(substr($response, 10, -8));
438+
}
437439
}
438440
if ($this->getResponseCode() < 500) {
439441
return $response;
@@ -518,7 +520,7 @@ function ($k, $v) {
518520
private function getHttp($url, $headers)
519521
{
520522
$method = 'GET';
521-
$response = $this->makeRequest($url, $headers, $data, $method);
523+
$response = $this->makeRequest($url, $headers, null, $method);
522524

523525
return $response;
524526
}

0 commit comments

Comments
 (0)