diff --git a/CHANGELOG.md b/CHANGELOG.md index f39e155..58da9f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,12 +2,16 @@ All notable changes to this project will be documented in this file, in reverse chronological order by release. -## 3.1.0 - TBD +## 3.1.0 - 2018-06-18 ### Added - Nothing. +### Changed + +- Nothing. + ### Deprecated - Nothing. @@ -18,7 +22,10 @@ All notable changes to this project will be documented in this file, in reverse ### Fixed -- Nothing. +- [#47](https://github.com/zendframework/zend-router/pull/47) fixes how the `Wildcard` URL assembly works. Previously, it would + attempt to `rawurlencode()` all values provided to the method as merged with any default values. + It now properly skips any non-scalar values when assembling the URL path. This fixes an issue + discovered when providing an array of middleware as a `middleware` default route parameter. ## 3.0.2 - 2016-05-31 diff --git a/composer.json b/composer.json index 461559c..458b606 100644 --- a/composer.json +++ b/composer.json @@ -50,8 +50,8 @@ }, "extra": { "branch-alias": { - "dev-master": "3.0-dev", - "dev-develop": "3.1-dev" + "dev-master": "3.1.x-dev", + "dev-develop": "3.2.x-dev" }, "zf": { "component": "Zend\\Router", diff --git a/composer.lock b/composer.lock index a09c00a..6ff4d36 100644 --- a/composer.lock +++ b/composer.lock @@ -1,10 +1,10 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "8624751621bbfc18a2c1dd41b0441e19", + "content-hash": "eeabe1c9995e9b7c0bbc518162270e5c", "packages": [ { "name": "container-interop/container-interop", diff --git a/src/Http/Wildcard.php b/src/Http/Wildcard.php index a56f3b7..e212e4e 100644 --- a/src/Http/Wildcard.php +++ b/src/Http/Wildcard.php @@ -168,8 +168,11 @@ public function assemble(array $params = [], array $options = []) if ($mergedParams) { foreach ($mergedParams as $key => $value) { - $elements[] = rawurlencode($key) . $this->keyValueDelimiter . rawurlencode($value); + if (! is_scalar($value)) { + continue; + } + $elements[] = rawurlencode($key) . $this->keyValueDelimiter . rawurlencode($value); $this->assembledParams[] = $key; } diff --git a/test/Http/WildcardTest.php b/test/Http/WildcardTest.php index a766868..de7e733 100644 --- a/test/Http/WildcardTest.php +++ b/test/Http/WildcardTest.php @@ -189,4 +189,19 @@ public function testEncodedDecode() $this->assertSame($out, $match->getParam('foo')); } + + public function testPathAssemblyShouldSkipAnyNonScalarValues() + { + $route = new Wildcard('/', '/', [ + 'action' => 'index', + 'controller' => 'index', + 'middleware' => [ + \Some\ConnectMiddleware::class, + \Some\Handler::class, + ], + ]); + + $path = $route->assemble(); + $this->assertEquals('/action/index/controller/index', $path); + } }