Skip to content

Commit 307d74e

Browse files
bug #908 [2.x] Use RFC3986 for building URI query strings (GrahamCampbell)
This PR was squashed before being merged into the 2.x branch. Discussion ---------- #906, but for 2.x. Commits ------- 1530c3f Update Authentication.php 6df6b9e Update AbstractApi.php
1 parent 03445f2 commit 307d74e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/Github/Api/AbstractApi.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ protected function get($path, array $parameters = [], array $requestHeaders = []
103103
}
104104

105105
if (count($parameters) > 0) {
106-
$path .= '?'.http_build_query($parameters);
106+
$path .= '?'.http_build_query($parameters, '', '&', PHP_QUERY_RFC3986);
107107
}
108108

109109
$response = $this->client->getHttpClient()->get($path, $requestHeaders);
@@ -126,7 +126,7 @@ protected function head($path, array $parameters = [], array $requestHeaders = [
126126
unset($parameters['ref']);
127127
}
128128

129-
return $this->client->getHttpClient()->head($path.'?'.http_build_query($parameters), $requestHeaders);
129+
return $this->client->getHttpClient()->head($path.'?'.http_build_query($parameters, '', '&', PHP_QUERY_RFC3986), $requestHeaders);
130130
}
131131

132132
/**

lib/Github/HttpClient/Plugin/Authentication.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function doHandleRequest(RequestInterface $request, callable $next, calla
6969
];
7070

7171
$query .= empty($query) ? '' : '&';
72-
$query .= utf8_encode(http_build_query($parameters, '', '&'));
72+
$query .= utf8_encode(http_build_query($parameters, '', '&', PHP_QUERY_RFC3986));
7373

7474
$uri = $uri->withQuery($query);
7575
$request = $request->withUri($uri);

0 commit comments

Comments
 (0)