diff --git a/CHANGELOG.md b/CHANGELOG.md index 3bafded..dc54495 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [1.3.1] - 2019-11-29 + +### Fixed +- Fix query string hash with false parameters (pull request #11, @jvanraaij) + ## [1.3.0] - 2019-10-27 ### Added @@ -66,7 +71,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Fixed - Package keywords at composer.json -[Unreleased]: https://github.com/brezzhnev/atlassian-connect-core/compare/v1.3.0...HEAD +[Unreleased]: https://github.com/brezzhnev/atlassian-connect-core/compare/v1.3.1...HEAD +[1.3.1]: https://github.com/brezzhnev/atlassian-connect-core/compare/v1.3.0...v1.3.1 [1.3.0]: https://github.com/brezzhnev/atlassian-connect-core/compare/v1.2.4...v1.3.0 [1.2.4]: https://github.com/brezzhnev/atlassian-connect-core/compare/v1.2.3...v1.2.4 [1.2.3]: https://github.com/brezzhnev/atlassian-connect-core/compare/v1.2.2...v1.2.3 diff --git a/src/Http/Auth/QSH.php b/src/Http/Auth/QSH.php index 3594875..194491f 100644 --- a/src/Http/Auth/QSH.php +++ b/src/Http/Auth/QSH.php @@ -192,12 +192,9 @@ protected function buildQuery(array $params): string $pieces = []; foreach ($this->encodeQueryParams($params) as $param => $values) { - $value = implode(',', $values); - - $pieces[] = implode('=', !$value - ? [$param] - : [$param, $value] - ); + $pieces[] = $values + ? implode('=', [$param, implode(',', $values)]) + : $param; } return implode('&', array_filter($pieces)); diff --git a/tests/Auth/QSHTest.php b/tests/Auth/QSHTest.php index e1fb370..2b7cfc2 100644 --- a/tests/Auth/QSHTest.php +++ b/tests/Auth/QSHTest.php @@ -61,6 +61,10 @@ public function testCanonicalQuery() $this->assertCanonicalQuery('a=x1&a=x10&b=y1&b=y10', 'a=x1,x10&b=y1,y10'); $this->assertCanonicalQuery('a=another+one&a=one+string&b=and+yet+more&b=more+here', 'a=another%20one,one%20string&b=and%20yet%20more,more%20here'); $this->assertCanonicalQuery('a=1%2C2%2C3&a=4%2C5%2C6&b=a%2Cb%2Cc&b=d%2Ce%2Cf', 'a=1%2C2%2C3,4%2C5%2C6&b=a%2Cb%2Cc,d%2Ce%2Cf'); + + // Parameter values that might evaluate weirdly in PHP + $this->assertCanonicalQuery('empty=', 'empty='); + $this->assertCanonicalQuery('since=0', 'since=0'); } /**