Skip to content

Commit

Permalink
Make URL extraction more robust, add php 5.3 support
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek committed Jan 8, 2022
1 parent fc479c7 commit 2644a11
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/Composer/Util/AuthHelper.php
Expand Up @@ -105,7 +105,8 @@ public function promptAuthIfNeeded($url, $origin, $statusCode, $reason = null, $
throw new TransportException('Could not authenticate against ' . $origin, 403);
}
$this->io->ask('After authorizing your token, confirm that you would like to retry the request');
return ['retry' => TRUE, 'storeAuth' => $storeAuth];

return array('retry' => true, 'storeAuth' => $storeAuth);
}

if ($rateLimited) {
Expand Down
7 changes: 4 additions & 3 deletions src/Composer/Util/GitHub.php
Expand Up @@ -182,11 +182,12 @@ public function getSsoUrl(array $headers)
{
foreach ($headers as $header) {
$header = trim($header);
if (false === strpos($header, 'x-github-sso: required')) {
if (false === stripos($header, 'x-github-sso: required')) {
continue;
}
list(, $url) = explode('=', $header, 2);
return $url;
if (Preg::isMatch('{\burl=(?P<url>[^\s;]+)}', $header, $match)) {
return $match['url'];
}
}

return null;
Expand Down

0 comments on commit 2644a11

Please sign in to comment.