Skip to content

Commit

Permalink
Merge pull request #273 from itsrexb/master
Browse files Browse the repository at this point in the history
#266 - PHP Deprecated: explode(): Passing null to parameter #2 ($stri…
  • Loading branch information
tareqtms authored Oct 24, 2022
2 parents f2e1428 + 44dadde commit b815f08
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/CurlRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,15 @@ protected static function processRequest($ch)
break;
}

$limitHeader = explode('/', $response->getHeader('X-Shopify-Shop-Api-Call-Limit'), 2);
$apiCallLimit = $response->getHeader('X-Shopify-Shop-Api-Call-Limit');

if (isset($limitHeader[1]) && $limitHeader[0] < $limitHeader[1]) {
throw new ResourceRateLimitException($response->getBody());
if (!empty($apiCallLimit)) {
$limitHeader = explode('/', $apiCallLimit, 2);
if (isset($limitHeader[1]) && $limitHeader[0] < $limitHeader[1]) {
throw new ResourceRateLimitException($response->getBody());
}
}

$retryAfter = $response->getHeader('Retry-After');

if ($retryAfter === null) {
Expand Down

0 comments on commit b815f08

Please sign in to comment.