33
0
mirror of https://github.com/joomla-extensions/patchtester.git synced 2025-02-02 11:58:26 +00:00

Account for differences in 3.x and 4.x HTTP client

This commit is contained in:
Michael Babker 2017-04-22 12:09:19 -05:00
parent e8fce0c7a6
commit 1a5b47a108

View File

@ -344,7 +344,15 @@ class PullsModel extends \JModelDatabase
if (isset($pullsResponse->headers['Link']))
{
preg_match('/(\?page=[0-9]&per_page=' . $batchSize . '+>; rel=\"last\")/', $pullsResponse->headers['Link'], $matches);
$linkHeader = $pullsResponse->headers['Link'];
// The `joomla/http` 2.0 package uses PSR-7 Responses which has a different format for headers, check for this
if (is_array($linkHeader))
{
$linkHeader = $linkHeader[0];
}
preg_match('/(\?page=[0-9]&per_page=' . $batchSize . '+>; rel=\"last\")/', $linkHeader, $matches);
if ($matches && isset($matches[0]))
{