Make sure the connection to mailchimp is working
[MAILPOET-2716]
This commit is contained in:
@ -35,6 +35,9 @@ class MailChimp {
|
|||||||
$response = '';
|
$response = '';
|
||||||
while (!feof($connection)) {
|
while (!feof($connection)) {
|
||||||
$buffer = fgets($connection, 4096);
|
$buffer = fgets($connection, 4096);
|
||||||
|
if (!is_string($buffer)) {
|
||||||
|
return $this->throwException('connection');
|
||||||
|
}
|
||||||
if (trim($buffer) !== '') {
|
if (trim($buffer) !== '') {
|
||||||
$response .= $buffer;
|
$response .= $buffer;
|
||||||
}
|
}
|
||||||
@ -81,8 +84,8 @@ class MailChimp {
|
|||||||
$i = 0;
|
$i = 0;
|
||||||
while (!feof($connection)) {
|
while (!feof($connection)) {
|
||||||
$buffer = fgets($connection, 4096);
|
$buffer = fgets($connection, 4096);
|
||||||
if (trim($buffer) !== '') {
|
if (trim((string)$buffer) !== '') {
|
||||||
$obj = json_decode($buffer);
|
$obj = json_decode((string)$buffer);
|
||||||
if ($i === 0) {
|
if ($i === 0) {
|
||||||
$header = $obj;
|
$header = $obj;
|
||||||
if (is_object($header) && isset($header->error)) {
|
if (is_object($header) && isset($header->error)) {
|
||||||
@ -100,7 +103,7 @@ class MailChimp {
|
|||||||
}
|
}
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$bytesFetched += strlen($buffer);
|
$bytesFetched += strlen((string)$buffer);
|
||||||
if ($bytesFetched > $this->maxPostSize) {
|
if ($bytesFetched > $this->maxPostSize) {
|
||||||
return $this->throwException('size');
|
return $this->throwException('size');
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user