Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use GuzzleHttp build_query instead of http_build_query when creating the baseString #70

Closed
wants to merge 1 commit into from

Conversation

wtrv
Copy link

@wtrv wtrv commented Oct 10, 2018

When sending a request which uses a query containing duplicate parameter keys, the signature is incorrectly generated.

eg. ?parameter=myvalue&paramter=myvalue2

This is being caused by the usage of "http_build_query" instead of the Guzzle "build_query" function in "createBaseString".


Closes #69.

@@ -203,7 +203,7 @@ protected function createBaseString(RequestInterface $request, array $params)
{
// Remove query params from URL. Ref: Spec: 9.1.2.
$url = $request->getUri()->withQuery('');
$query = http_build_query($params, '', '&', PHP_QUERY_RFC3986);
$query = \GuzzleHttp\Psr7\build_query($params, PHP_QUERY_RFC3986);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is now deprecated.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GrahamCampbell, the funtion is deprecrated in Guzzle Guzzle PSR 7.2, however this package is still supporting Guzzle 6.x. Also, the issue is not fixed by closing. In case this package would only support Guzzle PSR 7.2, I can provide a patch using the new Query::build() method.

@GrahamCampbell
Copy link
Member

Stale.

@bertramakers
Copy link

Since this was closed without a fix, I've documented a workaround for anyone else who runs into this here: #69 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong signature for query string with duplicate parameter keys
3 participants