Skip to content

Commit 1a5b47a

Browse files
author
Michael Babker
committed
Account for differences in 3.x and 4.x HTTP client
1 parent e8fce0c commit 1a5b47a

File tree

1 file changed

+9
-1
lines changed
  • administrator/components/com_patchtester/PatchTester/Model

1 file changed

+9
-1
lines changed

administrator/components/com_patchtester/PatchTester/Model/PullsModel.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,15 @@ public function requestFromGithub($page)
344344

345345
if (isset($pullsResponse->headers['Link']))
346346
{
347-
preg_match('/(\?page=[0-9]&per_page=' . $batchSize . '+>; rel=\"last\")/', $pullsResponse->headers['Link'], $matches);
347+
$linkHeader = $pullsResponse->headers['Link'];
348+
349+
// The `joomla/http` 2.0 package uses PSR-7 Responses which has a different format for headers, check for this
350+
if (is_array($linkHeader))
351+
{
352+
$linkHeader = $linkHeader[0];
353+
}
354+
355+
preg_match('/(\?page=[0-9]&per_page=' . $batchSize . '+>; rel=\"last\")/', $linkHeader, $matches);
348356

349357
if ($matches && isset($matches[0]))
350358
{

0 commit comments

Comments
 (0)