Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ public static function httpGetDataFromRemoteGz($url)
if ( $response_code === 200 ) { // Check if it's there
$data = static::httpRequestGetContent($url);

if ( empty($data['error']) ) {
if ( is_string($data) ) {
if ( static::getMimeType($data, 'application/x-gzip') ) {
if ( function_exists('gzdecode') ) {
$data = gzdecode($data);
Expand All @@ -796,13 +796,14 @@ public static function httpGetDataFromRemoteGz($url)
return array('error' => 'Can not unpack datafile');
}
} else {
return array('error' => 'Function gzdecode not exists. Please update your PHP at least to version 5.4 ' . $data['error']);
return array('error' => 'Function gzdecode not exists. Please update your PHP at least to version 5.4');
}
} else {
return array('error' => 'Wrong file mime type: ' . $url);
}
} else {
return array('error' => 'Getting datafile ' . $url . '. Error: ' . $data['error']);
$error_msg = is_array($data) && !empty($data['error']) ? $data['error'] : 'Unknown error';
return array('error' => 'Getting datafile ' . $url . '. Error: ' . $error_msg);
}
} else {
return array('error' => 'Bad HTTP response (' . (int)$response_code . ') from file location: ' . $url);
Expand All @@ -821,9 +822,11 @@ public static function httpGetDataFromRemoteGzAndParseCsv($url)
{
$result = static::httpGetDataFromRemoteGz($url);

return empty($result['error'])
? static::bufferParseCsv($result)
: $result;
if ( is_string($result) ) {
return static::bufferParseCsv($result);
}

return $result;
}

/**
Expand Down
Loading